My website had a older version of wordpress. Recently I upgraded it to the latest version. After that my php code what I write in the editor is keep getting disabled. The old page which has php code …
Tag: wordpress
Add Product Attributes with values to a product in Woocommerce
I am using this code to add custom attributes The result of this code I got added just product attribute Name without term values… See the picture I searched about that very much but did not got any answer. Answer There is some mistakes in your code. Your main mistake: The attribute terms to save as pro…
Woocommerce cart items discount gets reset in checkout
I’ve been trying to implement a discount in my store with the following code: add_action(‘woocommerce_before_calculate_totals’, ‘set_discount’, 10 ); function set_discount( $cart ) { if ( …
Exclude variations with 2 specific attribute terms from coupon usage in Woocommerce
I need to prevent coupons being used if customer have any specific product variations in their cart with following attribute terms: attribute_pa_style => swirly attribute_pa_style => circle I’ve looked through the Woocommerce scripts that apply to restricting specific products and specific categor…
Auto fill a Custom Post Type title from ACF field
I’d like to auto fill the title of three Custom Post Types (CPTs) based on an ACF field. I found the code below, but don’t know how to write it for three CPTs instead of just one. I would appreciate the help! Answer Try this code. It should work for you. Update Replace the previous code with the f…
Disable specific cart item quantity fields based on WooCommerce product category
In woocommerce I am using Hide “remove item” from cart for WooCommerce product category answer code and I would like to disable the cart quantity field too, avoiding customer to change the item quantity to zero. Is that possible? Any track on this will be appreciated. Answer The following code will remove the…
Disable only flat rate shipping method when free shipping is available in Woocommerce
I am using Hide specifics Flat Rates when Free Shipping is available in WooCommerce 3 lightly changed answer code to hide all shipping methods except one. The only method I want showing is a rate from the “Woocommerce Advanced Shipping” plugin. I am using the correct rate ID etc… Everything …
Hide “remove item” from cart for WooCommerce product category
I would like to Hide “remove item” from cart for a specific product category in WooCommerce, just like in “Hide “remove item” from cart for a specific product in WooCommerce” answer thread, but for a specific product category. Any help would be appreciated. Answer The follo…
Change field label text on Woocommerce login form
This Question is similar to Rename username label on woocommerce login page I am trying to change the Label “Username or email address” to “Your registered email address” I am trying to do this without modifying the form-login.php template file. So far I tried the below code: However, …
Pre-fill Woocommerce checkout fields with Url variable before session created
I have wordpress site running woocommerce with a few products. I want to send my customer a url to their product which includes their name and email so i can pre-fill name and email on woocommerce …