I Want to calculate custom shipping rates based on cart amount for woocommerce, My requirement as follows, Cart amount 0-10 => £4.99 (shipping_rate_id = flat_rate:12), 10-20 => £3.99 (…
Tag: wordpress
WordPress – “Notice: Undefined variable”
It seems like there are some PHP errors in my code where the index variable is not set. How could I fix it? Fill About.php Errors I get Notice: Undefined variable: index in /home/r328061/koopia/wp-content/themes/plaza/about.php on line 51 Notice: Undefined variable: index in /home/r328061/koopia/wp-content/th…
Headers already sent error with get_template_part in REST API call
I’ve looked at multiple other questions about this warning (Headers already sent…etc) and this thorough explanation, but I’m not finding a solution for the circumstances I’m dealing with: I have a custom WordPress REST API endpoint that returns the output of get_template_part. When I j…
Display WooCommerce Product Dimensions via a Shortcode
I am creating a custom layout (using Elementor) for a product – what I need is to have the dimensions of a product to display in a custom tab I have created. Is there a shortcode for product dimensions? (some of the products are variable too if that makes a difference) I have managed to get some code to…
How do I correctly filter by a specific product attribute (Brand in this case) in Woocommerce backend
I have to be upfront and say I haven’t coded in around 10 years. My knowledge is close to zero coding PHP but being a IT professional I am not a “complete” idiot. In the product list of Woocommerce (backend) I want to have a Brand filter. I made a product attribute called “Brand”…
Disallow customer to change country in WooCommerce checkout
I am looking for solution where I can find user’s country in woocommerce checkout page. I am doing it via geolocation. However, the user can change that. I want to restrict it. I am using a paid plugin to give coupons to users from a specific country. The country gets loaded perfectly and coupon is appl…
WooCommerce: change cart button text in loop to icon
I want to change the cart button text on archive pages to an icon. I found a snippet which does that. But that also changes the link of the cart button: Is there a way to change only the text of the button? I know, that I could change the template file /loop/add-to-cart.php. But I need a solution based on
WooCommerce: add extra images to product gallery
I want to add some extra images to the product gallery. Based on a meta field from a different post. The images should only add to the gallery in the frontend. Not to the image gallery of the product itself. EDIT: @mujuonly was right. I could use woocommerce_product_thumbnails and so I tried the following cod…
Changing shipped via text in WooCommerce orders and emails for specific shipping method
I am trying to change the shipped via in emails and in order information. I have a custom radio button with customer fields that are filled out only on the checkout page. Currently WooCommerce takes the label of the radio button but not the fields. I would like to have the fields only in customer email and in…
Add extra cost to flat rate shipping each 2 items from specific category in WooCommerce
Based on Add an additional cost to flat rate shipping each 3 items in Woocommerce answer code, I have made some changes to add an additional cost to flat are shipping method each 2 items (instead of …