Posts

Showing posts with the label orders

Product attribute empty value from order item in Woocommerce 3

Image
Product attribute empty value from order item in Woocommerce 3 I know that there are a lot of questions already for that matter but im not able to figure out how to get a custom product attribute from an woocommerce order. here is what i have try: $order = wc_get_order( $order_id ); $order_data = $order->get_data(); foreach ($order->get_items() as $item_key => $item_values) { $product = $item_values->get_product(); // Get the product $product_id = $item_values->get_product_id(); // the Product id $tokens = get_post_meta($product_id, 'Tokens', true); } I have also try: $tokens = $product->get_attribute( 'Tokens' ); and $tokens = array_shift( wc_get_product_terms( $product_id, 'Tokens', array( 'fields' => 'names' ) ) ); My custom product attribute has the name " Tokens " and the value 5000 but im getting an empty return, what am i doing wrong? That can h...

Renaming WooCommerce Order Status

Renaming WooCommerce Order Status I would like to rename the WooCommerce order status from "Completed" to "Order Received". I can edit the script below located in wc-order-functions.php, but I would prefer not to modify any core files or use a plugin. Is it possible to override woocoomerce functions with scripts in child theme's functions.php file? functions.php function wc_get_order_statuses() { $order_statuses = array( 'wc-pending' => _x( 'Pending Payment', 'Order status', 'woocommerce' ), 'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ), 'wc-on-hold' => _x( 'On Hold', 'Order status', 'woocommerce' ), 'wc-completed' => _x( 'Completed', 'Order status', 'woocommerce' ), 'wc-cancelled' => _x( 'Cancelled', 'Order status', 'woocommerce' ), ...