creating orders programmatically woocommerce_formatted_address_replacements?
-
I use the woocommerce_formatted_address_replacements filter to format the addresses like i want.
It works fine with normal orders.
But if I create an order programmatically like that:
$order = wc_create_order(); $order->add_product(get_product('12'), 2); $order->set_address($address, 'billing'); $order->set_address($address, 'shipping'); $order->calculate_totals();Then the filter doesn’t get applied to my addresses. $address contains correct data.
What could be the reason for this and how could I fix it?
protected string $formatted_billing_address protected string $formatted_shipping_addressWhy are these two protected? If they weren’t I could simply change them. Problem solved. 🙂
The topic ‘creating orders programmatically woocommerce_formatted_address_replacements?’ is closed to new replies.