Hide price, “add to cart” button and show message “Please log in to shop” [closed]

Just put some conditionals where you render your button. You’ll also need to figure out which page you’re on. if($is_single_product_page) { if( ! is_user_logged_in()) { ?> <div class=”message”>Please log in first</div> <?php } else { // end is_user_logged_in/false ?> <button class=”btn”>add to cart</button> <?php } // end is_user_logged_in/true }

How to Supply Console Logs Data into the WooCommerce Cart?

After doing lots of research I got my result with below code. To achieve final result I have to install WC Fields Factory plugin and pass dynamic value using console log or variable def Use this code under .js file and make sure it’s getting trigger when button is getting click. $w.event.subscribe(“item.book.click”, function(item) { $(‘[name=”room_type”]’)[0].value … Read more

Show total sales for each products on search results page Woocommerce

You can use third-party WooCommerce plugin ‘Woo Total Sales’ to display total sales of the specific product on product archive, product single or product search page. Woo Total Sales: https://wordpress.org/plugins/woo-total-sales/ You can also use below shortcode that plugin provides and add product ID to display its count. [awts-total-sales product_id=”0″ include_setting=”true/false”]

Return custom product in ajax call loop

Yes, you can query products by their ids and display them as ajax response. You code just needs a little revision. Perhaps you could try something along these lines, public function display_search_result(){ $skus = urldecode($_POST[‘sku_universel’]); $skus = explode(‘,’,$sku); $product_ids = array(); // you can use native woocommerce function to get the product ids foreach($skus as … Read more