Skip to content

Instantly share code, notes, and snippets.

@goranefbl
Forked from digitalchild/updates.php
Created January 2, 2018 13:34
Show Gist options
  • Save goranefbl/b26827032b7914c2ccbac580dcbf19a0 to your computer and use it in GitHub Desktop.
Save goranefbl/b26827032b7914c2ccbac580dcbf19a0 to your computer and use it in GitHub Desktop.
WooCommerce 3.0 Compatibility
<?php
# WooCommerce 2.6 -> 3.0 "Compatibility" Variables
$order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
$order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_date : $order->get_date_created();
$billing_first_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_first_name : $order->get_billing_first_name();
$billing_last_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_last_name : $order->get_billing_last_name();
$billing_email = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_email : $order->get_billing_email();
$billing_phone = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_phone : $order->get_billing_phone();
$billing_address_1 = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_address_1 : $order->get_billing_address_1();
$billing_address_2 = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_address_2 : $order->get_billing_address_2();
$billing_state = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_state : $order->get_billing_state() ;
$billing_city = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_city : $order->get_billing_city();
$billing_postcode = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_postcode : $order->get_billing_postcode();
$billing_country = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_country : $order->get_billing_country();
$shipping_first_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_first_name : $order->get_shipping_first_name();
$shipping_last_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_last_name : $order->get_shipping_last_name();
$shipping_address_1 = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_address_1 : $order->get_shipping_address_1();
$shipping_city = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_city : $order->get_shipping_city();
$shipping_country = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_country : $order->get_shipping_country();
$shipping_state = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_state : $order->get_shipping_state();
$shipping_postcode = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_postcode : $order->get_shipping_postcode();
$billing_email = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_email : $order->get_billing_email();
$customer_note = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->customer_note : $order->get_customer_note();
$order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_date : $order->get_date_created();
$orer_total = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->get_order_total() : $order->get_total();
$product_type = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $product->product_type : $product->get_type();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment