Relative Content

Tag Archive for woocommercehook-woocommerce

Detect Woocommerce orders with ‘Origin: Unknown’ and refuse them

I am getting a lot of orders from credit card scammers testing lists of cards by making small orders against my site. The vast majority of these fail, but one or two get through, which means I end up sending out items to people who don’t want them, with all the mess that entails.

Woocommerce – Add order weight to order page (HPOS Compatible)

I used to use a plugin to add the total order weight to each order and display it on the orders page on the back end. However, HPOS broke this and I have been trying to write the code to implement it again. I have Frankensteined a few snippets I have found, as my PHP skills are very limited, and this is as far as I have gotten, I just can’t seem to get it to populate the values.

After resubscription in WooCommerce subscription how to fetch the meta data ‘_subscription_resubscribe’

function action_wcs_create_subscription($subscription) { $NewSubscriptionId = $subscription->get_id(); update_option(‘NewSubscriptionId’,$NewSubscriptionId); $order = wc_get_order($NewSubscriptionId); $cancelledSubscriptionId = $order->get_meta(‘_subscription_resubscribe’); update_option(‘cancelledSubscriptionId’,$cancelledSubscriptionId); } add_action(‘wcs_create_subscription’,action_wcs_create_subscription’, 10, 20); I need to fetch the parent subscription id during resubscription process , I used the above hook , which returns the newly created subscription id , also i need to fetch the meta value of ‘_subscription_resubscribe’ , […]

Modifying cart total but not order value

I’m using this code to modify my total on the checkout page
However when I place the order, my order confirmation page and the order itself, emails etc reflect the unmodified checkout total