secureit
Forum Replies Created
-
Forum: Plugins
In reply to: [Payment Plugins for Stripe WooCommerce] Apple Pay Button Not DisplayForum: Plugins
In reply to: [Payment Plugins for Stripe WooCommerce] Apple Pay Button Not DisplayHere is a band-aid until the author fixes the issue. Goes in functions.php. Test before you deploy. I am not responsible if it doesn’t work in your environment.
add_filter('js_escape', 'fix_gtm4wp_js_bug', 10, 2); function fix_gtm4wp_js_bug ($safe_text, $text) { global $wp; $order_id = filter_var( wp_unslash( isset( $_GET['order'] ) ? $_GET['order'] : '' ), FILTER_VALIDATE_INT ); if ( ! $order_id & isset( $wp->query_vars['order-received'] ) ) { $order_id = $wp->query_vars['order-received']; } $order_id = absint( $order_id ); if ( $order_id > 0 ) { $order = wc_get_order( $order_id ); if($order->get_order_number() == $text) { $safe_text = str_pad($safe_text, strlen($safe_text) + 2, "'", STR_PAD_BOTH); } } return $safe_text; }- This reply was modified 2 years, 2 months ago by secureit.
Same issue.
Comment in code:
"// Store order ID to prevent tracking this purchase again."So while WooCommerce Order IDs are indeed numeric (order id = post id), your code is not using the Order ID. Your plugin is using the Order Number, which cannot be assumed to be numeric.
The latest version of WooCommerce is 8.5.1. You should upgrade your site.
I assume this helper function will be updated as well? This would have a potentially negative impact on my Pro version of the plugin.
/** * Woocommerce Product last order id return */ function woolentorBlocks_get_last_order_id(){ global $wpdb; $statuses = array_keys(wc_get_order_statuses()); $statuses = implode( "','", $statuses ); // Getting last Order ID (max value) $results = $wpdb->get_col( " SELECT MAX(ID) FROM {$wpdb->prefix}posts WHERE post_type LIKE 'shop_order' AND post_status IN ('$statuses')" ); return reset($results); }% grep -r woolentorBlocks_get_last_order_id ./wp-content/plugins/woolentor-addons-pro/*
blocks/thankyou-address-details/index.php: $received_order_id = woolentorBlocks_get_last_order_id();
blocks/thankyou-order-details/index.php: $received_order_id = woolentorBlocks_get_last_order_id();
blocks/thankyou-order/index.php: $received_order_id = woolentorBlocks_get_last_order_id();
Update: Experiencing the same issue, but with Apple Pay. It appears to be related to AvaTax
- This reply was modified 2 years, 10 months ago by secureit.