arthurlam1
Forum Replies Created
-
@mickaelperrin : Would you mind explaining how to do that?
Does that involve placing this in the functions.php?
define( 'WP_DEBUG', true );
Also – will normal functions on my website be affected because of this change?
- This reply was modified 3 years, 10 months ago by arthurlam1.
Hi @cartflows, that is very strange. Must I do any special configuration to make the checkout page show?
This is my view in Cartflows: https://i.imgur.com/BuxDFew.png
The URL of the checkout page is this eg. https://www.website.com/checkout-page/When I go to Elementor Display Conditions, I cannot find anything appearing when I enter the words checkout. What I see: https://i.imgur.com/oVqkpBj.png
Can you please help me out?
Thanks.
Thanks @cartflows. I am not a technical person. This is my Google Tag Manager code as shown below. Can you please let me know (1) how to use your actions
wp_head
andcartflows_body_top
and (2) where do I insert it?Paste this code as high in the <head> of the page as possible: <!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-XXXXXX');</script> <!-- End Google Tag Manager --> Additionally, paste this code immediately after the opening <body> tag: <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) -->
Thank you.
Forum: Plugins
In reply to: [WooCommerce] Possible to assign user with a role without signing in?@amandasjackson Sorry if I wasn’t clear. I do not want to create users. I just want to assign users with a role based on the website they came from (Facebook / Google etc). I do not want users to sign in also.
Is this possible? Thanks.
Forum: Plugins
In reply to: [WooCommerce] Help with implementing PHP code@purpleberryservices my bad. Managed to solve it!
Thank you! And yes it works ??
Forum: Plugins
In reply to: [WooCommerce] Help with implementing PHP code@purpleberryservices Thanks. I removed the comma at the end and replaced it with a ;
The below code is what I am using. I now get an error message
syntax error, unexpected '='
add_action( 'woocommerce_thankyou', 'pbs_redirect_to_custom_thank_you'); function pbs_redirect_to_custom_thank_you( $order_id ){ $order = wc_get_order( $order_id ); if ( ! $order->has_status( 'failed' ) ) { $url = 'https://website.com/upsell/; wp_redirect( $url.'?id='.$order_id ); exit; } }
Forum: Plugins
In reply to: [WooCommerce] Help with implementing PHP code@purpleberryservices Thanks.
Believe I should put your code within functions.php?
I get this error message:
syntax error, unexpected 'wp_redirect' (T_STRING)
. Below is the updated code for the upsell page. Can you let me know what went wrong? Thanks.add_action( 'woocommerce_thankyou', 'pbs_redirect_to_custom_thank_you'); function pbs_redirect_to_custom_thank_you( $order_id ){ $order = wc_get_order( $order_id ); if ( ! $order->has_status( 'failed' ) ) { $url = 'https://website.com/upsell/' wp_redirect( $url.'?id='.$order_id ); exit; } }
Forum: Plugins
In reply to: [WooCommerce] Help with implementing PHP code@riaanknoetze Hey RK, sure let me explain to you the use case.
Background
We have changed the checkout process slightly in WooCommerce
Usually, a user goes: Order Checkout –> Thank you Page (where Order ID appears) –> Upsell page
Now it goes like this: Order Checkout –> Upsell Page
This redirect is achieved using this script:
add_action( 'template_redirect', 'woo_custom_redirect_after_purchase' ); function woo_custom_redirect_after_purchase() { global $wp; if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) { wp_redirect( 'https://website.com/upsell/' ); exit; } }
Question
The issue here is that I can’t extract Order ID from the DOM in the Thank You page because after checkout we immediately redirect users to the Upsell page.
So is there a way to push the Order ID into a Javascript variable on the Upsell Page? Thus, I tried to follow what the Stack Overflow Article did.
Thank you.
- This reply was modified 4 years, 6 months ago by arthurlam1.
Forum: Developing with WordPress
In reply to: Help with implementing PHP code@corrinarusso Where do I find the template file?
I want the output to display on the upsell page that comes after the checkout page.
Thanks.
Forum: Plugins
In reply to: [WooCommerce] Pass WooCommerce variables to Javascript variables@lorro Thanks for the reply. Just to respond to your question about “if this is the result of an event”, I don’t think it is because the Order ID is just generated on page load on the Thank You page automatically?
I am quite new to this so can you please help me out with the following questions?
Question 1: In this code you provided, how do you pull the actual order ID from WooCommerce instead of a hardcoded 123?
<?php $order_id = 123; print '<script>'; print 'var order_id = "' . $order_id . '";'; print '</script>';
Question 2: Apologies for not being clearer but the Order ID first appears on the Thank You page. However, I would only want to retrieve the Order ID into a javascript variable on a different page (an Upsell page). Is it possible to do this?
Thank you.
@utkarsh5474 nope I don’t have an answer…
Forum: Plugins
In reply to: [WooCommerce] Code provided in documentation to complete orders not working?@jricketts4 Hey Joey, thanks. Could you let me know where to find the default order status for each payment option? I am trying to troubleshoot to see if there are any conflicts.
Thank you.
Forum: Plugins
In reply to: [WooCommerce] Redirect WooCommerce when users select payment method?@luminus thanks for the reply. Is it possible to add multiple Cash on Delivery method? Would like to add one where Customers Pay At My Store. Another is Customers Pay At Their House.
@aoedigi mind sharing which plugin you used to solve the issue? Thanks.
Forum: Plugins
In reply to: [WooCommerce] Change order of WooCommerce Checkout fieldsHi Joey,
Thanks for your reply. This is the full file path:
/test.com/wp-content/themes/hello-theme-child-master/woocommerce/checkout/form-checkout.phpIf the file path is not the issue, perhaps the file provided by jessepearson was for an old version of WooCommerce (2.3.0) and hence doesn’t work? I amended the file myself and placed it in the same folder and it seems to work. Would you mind helping me see if I made the changes correctly? Link: https://rebrand.ly/joeywoocommerce
Thanks!