Every out of stock product says “Out of Stock” There are plenty of functions.php scripts that overwrite the text but I am only trying to overwrite the text specific to “Category A” or if I know the category “id” number, that could work too. I found this script but it allows…
Tag: woocommerce
Woocommerce Change product price by ID
I have an array with product id (post_id). My goal is to loop thru this array and change all the product prices in WooCommerce products. Here is my attempt: foreach ($array as $product) { …
Hide coupon discount raw if no coupon has been applied on WooCommerce cart page
I add coupons and discounts total savings to my cart page. My code works fine but I have an additional question. This is the code I am currently using: add_action( ‘…
Error when removing a produсt from favorites (I created the wishlist system myself)
guys! I faced some issue again. For a project on WooCommerce I created the custom system favorite products. The default one did not suit us.I could implement the addition created this code: Button for adding to the favorite list The jQuery code The code in function: But I have not thought about the removal sy…
WooCommerce changing order line totals
I have a plugin which applies discounts based on the category of the product. I’m using the filters below to add text to the order table in the cart: And this action to change the total price of the order/cart. The total price of the order pulls through to the checkout, as do the modified product fields…
Apply a welcome discount to non “on sale” items in WooCommerce
I use this code to set up a “welcome” discount for a registered user: add_action( ‘woocommerce_cart_calculate_fees’, ‘personal_discount_based’, 20, 1 ); function personal_discount_based( $…
Add and wrap product categories WordPress/Woocommerce in product loop
I use this snippet for display product categories in product loop on Shop and archives pages: I want this: To achieve this I use jQuery: How can I modify my PHP snippet to avoid using jQuery? Answer You could just append the corresponding tag before & after your foreach loop: Then you don’t need to …
What hook for product image replacement in WooCommerce shop page
What function is called when WooCommerce returns image for products in shop page? I would like to replace image with something else. Answer To find out, you need look at content-product.php template source code from line 36 to 42: So when looking at woocommerce_template_loop_product_thumbnail() involved hooke…
Enable decimal quantities and stock for WooCommerce products
I want to change the default quantity from the products, from 1 to 0,1 but I can’t seem to figure it out. I tried the following: The problem with this is that modifies the quantity input from cart as well, which isn’t what I want. To be more specific I want the following: when I go to the product …
Add custom “Add to cart” button based on ACF field to WooCommerce single product page
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…