Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Conversation

@emdashcodes
Copy link

See Automattic/wp-calypso#16660.

The emails being sent to the store admin (which is also our only notification right now) links to wp-admin instead of Calypso. This PR adds a hotfix for overwriting the templates with our own, linking to WP.com.

To Test:

  • Upload/install this branch over your existing wc-api-dev plugin.
  • Go through the check-out process and make sure you receive an admin order notification email.
  • Make sure that the link on the Order # goes to WP.com (make sure you are looking at the admin notification, and not the notification that is sent to the customer).
  • To test the plaintext email (which is not currently an option we offer on .com, but I provided here anyway), you can go to wp-admin > WooCommerce > Settings > Emails > New Order and then set it to plaintext.
  • Repeat the above steps.

@emdashcodes emdashcodes self-assigned this Jul 31, 2017
@emdashcodes emdashcodes requested review from allendav and ryelle July 31, 2017 22:31
@emdashcodes emdashcodes force-pushed the update/order-url branch 3 times, most recently from a2493f8 to bc562ef Compare August 4, 2017 13:55
@emdashcodes emdashcodes changed the base branch from master to update/paypal-enabled-default August 4, 2017 13:55
@emdashcodes emdashcodes force-pushed the update/paypal-enabled-default branch from bfca28e to 0ca1d3f Compare August 4, 2017 14:12
@emdashcodes emdashcodes force-pushed the update/order-url branch 2 times, most recently from 5de4834 to ad3596c Compare August 4, 2017 14:14
Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about the URL builder, but otherwise it seemed to test OK.

My api-dev test site is just pressable, not AT, so I got redirected back to /stats/ when I clicked the email links, but if I switched them to wpcalypso they're fine.

}

function wc_api_dev_email_get_wpcom_order_link( $order_id ) {
$site_slug = preg_replace( '/^https?:\/\//', '', get_site_url() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not something to worry about immediately, but this won't work for URLs where WP is in a subfolder. You can steal Jetpack's build_raw_urls function though (and it looks like this is usually passed get_home_url, not get_site_url).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch and suggestion. I think it's a good idea to handle this now so we don't run into issues later.

@emdashcodes
Copy link
Author

I'll re-open this after the plugin split.

@emdashcodes emdashcodes closed this Aug 7, 2017
@emdashcodes emdashcodes changed the base branch from update/paypal-enabled-default to master August 7, 2017 23:29
@emdashcodes emdashcodes reopened this Aug 7, 2017
@emdashcodes
Copy link
Author

emdashcodes commented Aug 7, 2017

@ryelle I made the change that should allow for sites w/ paths later on. Can you take a look/test and ✅ if everything looks good?

Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good 👍 I don't actually have a subfolder site to test on, but I know that pattern works for jetpack, so I think you're good to merge

@emdashcodes emdashcodes merged commit de465e7 into master Aug 8, 2017
@coderkevin coderkevin deleted the update/order-url branch August 31, 2017 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants