L
L
lamweb2019-08-15 15:05:25
WordPress
lamweb, 2019-08-15 15:05:25

How to replace add to cart button in WP?

There is a button for the product - Add to cart - that 5d55485d10f7d449875060.png's when you press it, it adds the product to the cart). And you need this button to change if the product is added to the cart. The client added the product the button has changed for example - the button says - the product has been added.
Here is the code

<a rel="nofollow" href="/?add-to-cart=<?php echo $post->ID; ?>" data-quantity="1" data-productid="<?php echo $post->ID; ?>" data-productsku="" class="button producttypesimple <?php echo (getpostmeta($post->ID, 'managestock', true) == 'yes' && (getpostmeta($post->ID, 'stock', true) - $productquantity) > 0) ? 'add addtocartbutton' : 'addtocartfalse'; ?> ajaxaddtocart added"><?php echo (getpostmeta($post->ID, 'managestock', true) == 'yes' && (getpostmeta($post->ID, 'stock', true) - $product_quantity) > 0) ? '' : 'Нет в наличии.'; ?></a>

I do not understand where to add. Who can advise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lamweb, 2019-08-15
@lamweb

I don't understand where to add your code.
Well, even I guess that all the magic happens in the code above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question