skip to Main Content

Set a custom shipping cost on every 10th Order in WooCommerce

WP 5.3.3 I need to change shipping cost programmatically, after order creation. This code doesn't affect: add_action('woocommerce_new_order', 'custom_shipping_costs', 1, 1); function custom_shipping_costs($order_id) { $order = wc_get_order($order_id); $shippingItems = (array) $order->get_items('shipping'); foreach ($shippingItems as $item) { $item->cost = 0; } $order->save();…

VIEW QUESTION
Back To Top
Search