WooCommerce customize parts: Unterschied zwischen den Versionen

Aus wiki.sehanka.de
Zur Navigation springen Zur Suche springen
Zeile 7: Zeile 7:
* https://wordpress.stackexchange.com/questions/337852/query-woocommerce-orders-where-meta-data-does-not-exist
* https://wordpress.stackexchange.com/questions/337852/query-woocommerce-orders-where-meta-data-does-not-exist
* https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query
* https://github.com/woocommerce/woocommerce/wiki/wc_get_orders-and-WC_Order_Query
<syntaxhighlight lang=php>
// Get an instance of the WC_Order object (same as before)
$order = wc_get_order( $order_id );


$order_id  = $order->get_id(); // Get the order ID
$parent_id = $order->get_parent_id(); // Get the parent order ID (for subscriptions…)
$user_id  = $order->get_user_id(); // Get the costumer ID
$user      = $order->get_user(); // Get the WP_User object
$order_status  = $order->get_status(); // Get the order status
$currency      = $order->get_currency(); // Get the currency used 
$payment_method = $order->get_payment_method(); // Get the payment method ID
$payment_title = $order->get_payment_method_title(); // Get the payment method title
$date_created  = $order->get_date_created(); // Get date created (WC_DateTime object)
$date_modified = $order->get_date_modified(); // Get date modified (WC_DateTime object)
$billing_country = $order->get_billing_country(); // Customer billing country
</syntaxhighlight>


=== Meta Felder ===
=== Meta Felder ===

Version vom 10. März 2022, 11:04 Uhr

Orders

Felder

Query wc_get_orders

// Get an instance of the WC_Order object (same as before)
$order = wc_get_order( $order_id );

$order_id  = $order->get_id(); // Get the order ID
$parent_id = $order->get_parent_id(); // Get the parent order ID (for subscriptions…)

$user_id   = $order->get_user_id(); // Get the costumer ID
$user      = $order->get_user(); // Get the WP_User object

$order_status  = $order->get_status(); // Get the order status 
$currency      = $order->get_currency(); // Get the currency used  
$payment_method = $order->get_payment_method(); // Get the payment method ID
$payment_title = $order->get_payment_method_title(); // Get the payment method title
$date_created  = $order->get_date_created(); // Get date created (WC_DateTime object)
$date_modified = $order->get_date_modified(); // Get date modified (WC_DateTime object)

$billing_country = $order->get_billing_country(); // Customer billing country

Meta Felder

https://help.themehigh.com/hc/en-us/articles/900005426543-Frequently-Asked-Questions

<?php $order_meta = get_post_meta( $order_id, $field_name, true ) ;?>
<?php echo get_post_meta( $order->id, '_shipping_first_name', true) ;?>

Customize Checkout Fields