F
F
Fqwd1232021-07-16 05:54:47
WordPress
Fqwd123, 2021-07-16 05:54:47

Add to card button?

On the category page, I have product cards with an add to card button, here is its code:

<a rel="nofollow" href="<?= $product->add_to_cart_url() ?>" data-id="<? the_ID() ?>"
data-quantity="1" data-product_id="<? the_ID() ?>" data-product_sku="<? the_sku() ?>"
class="button btn-cyan add-to-cart add_to_cart_button ajax_add_to_cart"><?= esc_html($product->single_add_to_cart_text()); ?></a>

I need to make a modal window appear when clicked, but I don’t quite understand how (I did the same on the product page, but everything is simple there because there is a form). Tell me how to implement it?
Correctly, I understand that when you click, the added_to_cart event should be triggered? Or some other standard wukumers events that you can hang on?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fqwd123, 2021-07-16
@Fqwd123

I figured it out, everything was banal - an error in the jquery code did not allow the action to start

N
Nikolai Dubkov, 2021-07-16
@vokbud

Find the necessary hook for this event and write the function.
You can read what it is in the Woocommerce documentation , as well as in their API .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question