D
D
DeniSidorenko2019-05-10 09:09:23
WooCommerce
DeniSidorenko, 2019-05-10 09:09:23

How to display cross-sells through the Woocommerce loop?

Hello, I need to display crossels on the cart page. Tell me how can I do this through a loop in order to display the structure that I need?)
Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pychev Anatoly, 2019-05-10
@pton

1. Connect to the hook of the place where you want to display
2. Run through the contents of the cart and collect the IDs of the added products
3. Make an arbitrary request to the database and create a custom output loop. You can read it in the codex or here
4. Output your html

A
Artem Abramovich, 2019-05-16
@artikus

This is the standard functionality. If cross-sells for products are specified, they are displayed automatically. Output by functionwoocommerce_cross_sell_display

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question