The fact is that the customer asks for a 50% discount for “Local Pickup” – I have already done this (I found a code here on StackOverFlow that applies a discount on all goods), but there is …
Tag: woocommerce
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_c…
How to make a custom cart fee to be taxable in WooCommerce
Found exactly the snippet I was looking for to add a fixed fee amount to each individual cart item regardless of price. This site sells tires. So each tire will be charged 3$. Here is the code I’m using and works: I’m not very good with PHP and I’m learning as I go. I did spend 3 hours tryin…
Add product data to WooCommerce admin order preview
I used this code for displaying the product attributes in the order details/editor And it seems to work, but there is an error in the admin panel: Fatal error: Uncaught Error: Call to a member function get_id() on null Help me figure it out, I don’t understand why this is happening. Answer To avoid your…
Get non formatted value from $order->get_formatted_line_subtotal() in WooCommerce
I need to make certain changes to the file order-details-item.php Product prices are formed in custom meta fields. So in my case the value is: $qty = $item->get_quantity(); is incorrect. It is always the same. To solve the problem, I can use the simplest arephmetic operation. Divide the total order price b…
Get all persons as a sum from all WooCommerce bookings
I use the official woocommerce booking plugin and I try do get the quantity of all persons that have booked a product. for a single order that’s no problem with: but how can I collect the sum of all bookings? Hope you can help me Answer To get all “complete” bookings persons count use the fo…
WooCommerce: How to change the product link conditionally?
In WooCommerce, I’m trying to change the default product link format https://domain-name.com/product/single-product-name/ for sold out products to the following format: https://domain-name.com/product/single-product-name/#reviews. So I need to add #reviews to the product link, if the product is sold out…
How to hide a link using php and css
I am trying to apply some css in my php for a test to see how to hide a button in my php file. It’s not happening at the moment and I am not sure why it is not removing the button. HTML: PHP UPDATE The above code is a test code to try and fix the main code below:
How to get current selected variable product specific data in WooCommerce
I want to access the selected product variation Weight value in php. I tried below code its getting last value of attribute, not selected. Answer The selected variation properties can only be accessed via Javascript as it’s a client side live event… Here below is an example, that will display the select…
Remove “Home” and go direct to WooCommerce “Orders” on WordPress Admin dashboard
Using the most recent version of WooCommerce, there’s a “Home” section that I cannot remove using any built in setting. I have managed to remove the analytics and marketing option, but how …