WooCommerce customize parts: Unterschied zwischen den Versionen

Aus wiki.sehanka.de
Zur Navigation springen Zur Suche springen
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:


== Orders ==
== Orders ==
=== Felder ===
Überblick
* https://www.businessbloomer.com/woocommerce-easily-get-order-info-total-items-etc-from-order-object/
* https://developer.woocommerce.com/2022/01/17/the-plan-for-the-woocommerce-custom-order-table/


Query wc_get_orders
Query wc_get_orders
* 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
<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 ===


=== Felder ===
https://help.themehigh.com/hc/en-us/articles/900005426543-Frequently-Asked-Questions
<syntaxhighlight lang=php>
<?php $order_meta = get_post_meta( $order_id, $field_name, true ) ;?>
</syntaxhighlight>


* werden zB vom Plugin checkout-field-editor-pro benutzt
* https://www.themehigh.com/product/woocommerce-checkout-field-editor-pro/
<syntaxhighlight lang=php>
<syntaxhighlight lang=php>
<?php echo get_post_meta( $order->id, '_shipping_first_name', true) ;?>
<?php echo get_post_meta( $order->id, '_shipping_first_name', true) ;?>
</syntaxhighlight>
</syntaxhighlight>
* https://programmierfrage.com/items/how-to-get-meta-value-from-woocommerce-order


== Customize Checkout Fields ==
== Customize Checkout Fields ==

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

Orders[Bearbeiten]

Felder[Bearbeiten]

Überblick

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[Bearbeiten]

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[Bearbeiten]