Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Store Editing Templates: Currently using the incorrect slug for WooCommerce #5423

Closed
tjcafferkey opened this issue Dec 20, 2021 · 1 comment · Fixed by #5519
Closed

Store Editing Templates: Currently using the incorrect slug for WooCommerce #5423

tjcafferkey opened this issue Dec 20, 2021 · 1 comment · Fixed by #5519
Assignees
Labels
focus: FSE Work related to prepare WooCommerce for FSE. focus: template Related to API powering block template functionality in the Site Editor type: bug The issue/PR concerns a confirmed bug.

Comments

@tjcafferkey
Copy link
Contributor

tjcafferkey commented Dec 20, 2021

Describe the bug

Amongst the code for the WooCommerce Store Editing Templates we are using the id/slug woocommerce or WooCommerce for our block templates. We've recently discovered the correct value should possibly be woocommerce/woocommerceand have noticed a number of issues because of this:

  • On the frontend when the component tries to fetch the WooCommerce plugin data by slug, it fails to get anything.
  • XHR requests are being sent to incorrect endpoints such as /wp-json/wp/v2/plugins/WooCommerce and getting a 404 response, when the should be going to /wp-json/wp/v2/plugins/woocommerce/woocommerce.
  • In the database under the table wp_terms we're saving this incorrect slug as woocommerce (under name and slug columns) when it should be woocommerce/woocommerce (name) and woocommerce-woocommerce (slug).

As a result of this, if we were to simply make some code amendments and update our usages to use the correct value, this means that users who have already modified their WooCommerce templates would no longer see them listed in the Templates list view, and they would also not be found when fetching them to render on the frontend because we'd be looking for the new value (woocommerce/woocommerce) when searching the DB for templates saved against the old value (woocommerce)

Related #5420
Related #5412
Related #5375
Related #5327

@tjcafferkey tjcafferkey added type: bug The issue/PR concerns a confirmed bug. focus: FSE Work related to prepare WooCommerce for FSE. focus: template Related to API powering block template functionality in the Site Editor labels Dec 20, 2021
@gigitux
Copy link
Contributor

gigitux commented Dec 20, 2021

We've recently discovered the correct value should possibly be woocommerce/woocommerce (this will need double checking)

I agree with double-checking this.

If we are sure that the structure is plugin-slug//template-slug and our plugin slug is woocoommerce/woocommerce we are ready to go.

My concern is that woocoommerce/woocommerce//${slug} could be not very clear if it is checked by someone that doesn't have context, it can be a little bit tricky.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: FSE Work related to prepare WooCommerce for FSE. focus: template Related to API powering block template functionality in the Site Editor type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants