Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------QUANTITY IN CART (activate relevant snippet for this to work) -------------------
- <?php
- global $product;
- $product_id = $product->get_id();
- $in_cart = false;
- foreach( WC()->cart->get_cart() as $cart_item ) {
- $product_in_cart = $cart_item['product_id'];
- if ( $product_in_cart === $product_id ) $in_cart = true;
- }
- if ( $in_cart ) {
- echo do_shortcode('[product_qty id="'. $product_id . '"]');
- }
- ?>
- //------------------BUY NOW BUTTON---------------------
- <a href="<?php echo esc_url(home_url( '/' ));?>checkout/?add-to-cart=<?php the_ID();?>" class="quick-buy single_add_to_cart_button button alt" ><?php esc_html_e('Buy now', 'demo.local'); ?></a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement