Skip to content

Commit

Permalink
Fix WC $order->id called incorrectly in order emails (#1189)
Browse files Browse the repository at this point in the history
The correct usage is `$order->get_id()`.
  • Loading branch information
herrvigg committed Jun 14, 2022
1 parent 10e1ca5 commit 9a316bf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/woo-commerce/qwc-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ function qtranxf_wc_add_filters_admin() {
add_filter( $name, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', $priority );
}

add_filter( 'woocommerce_attribute_taxonomies' , 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' );
add_filter( 'woocommerce_variation_option_name' , 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' );
add_filter( 'woocommerce_attribute_taxonomies', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' );
add_filter( 'woocommerce_variation_option_name', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage' );
}

qtranxf_wc_add_filters_admin();
Expand Down Expand Up @@ -345,16 +345,16 @@ function qtranxf_wc_admin_email_option( $val ) {
* This helps to use order's language on re-sent emails from post.php order edit page.
*
* @param $content
* @param null $order
* @param WC_Order $order
*
* @return array|mixed|string|void
*/
function qtranxf_wc_admin_email_translate( $content, $order = null ) {
global $q_config;

$lang = null;
if ( $order && isset( $order->id ) ) {
$lang = get_post_meta( $order->id, '_user_language', true );
if ( $order && $order->get_id() ) {
$lang = get_post_meta( $order->get_id(), '_user_language', true );
}
if ( ! $lang ) {
$lang = $q_config['language'];
Expand All @@ -369,14 +369,14 @@ function qtranxf_wc_admin_email_translate( $content, $order = null ) {
* Called to process action when button 'Save Order' pressed in /wp-admin/post.php?post=xxx&action=edit
* Helps to partly change language in email sent, but not all, since some parts are already translated into admin language.
*
* @param $order
* @param WC_Order $order
*/
function qtranxf_wc_admin_before_resend_order_emails( $order ) {
if ( ! $order || ! isset( $order->id ) ) {
if ( ! ( $order && $order->get_id() ) ) {
return;
}

$lang = get_post_meta( $order->id, '_user_language', true );
$lang = get_post_meta( $order->get_id(), '_user_language', true );
if ( ! $lang ) {
return;
}
Expand Down

0 comments on commit 9a316bf

Please sign in to comment.