I want to add an additionall custom “Add to cart button” on the single product page conditionally using this code: This variable is field from ACF $mamut = get_field(‘mamut’); However when I put this code into my functions.php file, the single product page crash I am using theme Twenty nineteen and Elementor Pro. I’ve tried to remove actions and then
Tag: product
Add to cart validation in WooCommerce based on attribute value and product quantity from the cart page
Actually, I am trying to set a limit for adding to cart for some product ids based on product attribute. What i’ve done is: It works in a loop, but on the product page, it doesn’t take into account quantity input. Is there a way to get quantity add input in my function? Answer woocommerce_add_to_cart_validation contains 5 parameters (the last
Sort by custom meta value doesn’t work in WooCommerce products sort by
I’m trying to add a sorting option for woocommerce products’s list. The goal is to sort products by a meta value with meta key called _rating. For now I generate this meta value with a function …
WP_Query issue when trying to get out of stock products in WooCommerce
I’m using shortcode to display all sold out WooCommerce items on a WordPress page. It works fine, except for throwing an error: I figure that this means array_filter() expects an array, but is given null from the following code in my functions.php: Shortcode: [out_of_stock_products] Here’s the WooCommerce function that expects the array but is given null: I’m not sure how
Get WooCommerce specific product attribute terms sorted by “menu order”
I want to sort get_the_terms by menu_order of the curent product and till now i have this code: Answer There is 2 ways to get the product attribute term names sorted by menu order (for a defined product): 1). Using wp_get_post_terms() function (WordPress way) The WordPress function get_the_terms() doesn’t allow to alter the WP_Term_Query… So instead you will use similar
Product variation and parent variable product objects in WooCommerce hook
I developed a custom delivery time info for variations. But for some reason, I can’t get the parent product id of the variation to use it in my function. I tried the following – if I set $id straight …
Get and display the tax rate on Woocommerce single product pages
I’m trying to find a way how I could only display the Tax rate (16% or 7%), which a product has. Basically the idea is that there should be a static tax like. The price includes 16% Taxes or The price includes 7% Taxes So the percent rate should be dynamic based on which rate the product has. Any idea
WooCommerce – Turning the product tag cloud into a complex refine feature
QUESTION: How am I able to combine these two blocks of code so they work as one? I do not require any shortcode solutions, I prefer the function format used in the first block of code, however the …
How can I show individual stock quantities for variable products on the product page in WooCommerce
I am trying to show each variable products stock quantity on the single product page in WooCommerce. I have managed to show all the stock quantities for all the variations using the below code from …
Display shipping class name on WooCommerce single product pages
Need to display the product shipping class to product page! any ideas why this is not working? add_action(‘woocommerce_single_product_summary’, ‘display_product_shipping_class’, 15 ); function …