Friday, September 22, 2023
HomeMobile MarketingWooCommerce: Why It is A Ache To Migrate Between Staging and Manufacturing......

WooCommerce: Why It is A Ache To Migrate Between Staging and Manufacturing… And How To Work Round It


Whereas we’re comfy declaring our experience in WordPress, it’s not with out challenges. One problem that’s fairly irritating is the database structure utilized for WooCommerce. Particularly, varied data are saved within the wp_posts desk in WordPress, and their submit sort categorizes them. Right here’s a listing of some frequent submit varieties used together with a short description of every:

  1. Product: Submit sort product is used to retailer details about particular person merchandise in your WooCommerce retailer. This consists of product identify, worth, description, and extra particulars.
  2. Product Variation: Submit sort product_variation represents totally different product variations, akin to measurement or colour choices. These are linked to the principle product.
  3. Order: Submit sort shop_order shops details about buyer orders, together with order standing, buyer particulars, and gadgets ordered.
  4. Order Refund: Submit sort shop_order_refund tracks refunds related to particular orders.
  5. Coupon: Submit sort shop_coupon shops particulars about coupons and reductions that may be utilized to orders.
  6. Store Webhook: Submit sort shop_webhook is used for storing info associated to webhooks, which can be utilized to set off actions in response to occasions in your WooCommerce retailer.
  7. Store Subscription: Submit sort shop_subscription It’s related in case your retailer has subscription-based merchandise and shops details about buyer subscriptions.
  8. Store Subscription Renewal: Submit sort shop_subscription_renewal is used to report subscription renewals.
  9. Store Subscription Change: Submit sort shop_subscription_switch tracks modifications or switches in subscription merchandise.
  10. Store Subscription Pending Fee: Submit sort shop_subscription_pending_payment represents subscription orders with pending funds.
  11. Store Subscription Failed: Submit sort shop_subscription_failed is used to report failed subscription funds.
  12. Product Overview: Submit sort product_review is used to retailer buyer evaluations for merchandise. Every evaluate is handled as a separate submit, together with reviewer info, evaluate textual content, and rankings for the related product.

When you’re designing or implementing a brand new theme for WordPress, you usually push a replica of the location and database to a staging or native growth setting. In the meantime, the location continues to gather orders and different ecommerce relevant occasions.

Database Conflicts in wp_posts

In different phrases, data are being created in manufacturing that can battle with them. Instance: You add a brand new web page on staging and the subsequent incremental ID is 6702. Nonetheless, there’s an order in your manufacturing setting that’s utilizing the identical incremental ID of 6702. There are a few points with this:

  • Order IDs will not be sequential. When you have one order that’s 5 after which construct 3 pages, your subsequent order ID is 9. Viewing your order ID offers you no perception in any respect into the variety of orders you’ve fulfilled in your web site.
  • Order IDs can’t be modified! WooCommerce makes use of that ID and communicates it on to your buyer in all subsequent invoices and order references.

It’s fairly troubling that WooCommerce engineers didn’t make the most of a further area for orders that’s each sequential and distinctive, however differed from their inner ID. In different phrases, ID 6702 might have been bill 4322… and simply added between databases with a unique ID in wp_posts. Merchandise do that with an non-obligatory SKU area, however it’s additionally not totally built-in with the platform to make the most of that as a major key.

I love the simplicity of this strategy to increasing the platform into commerce. That mentioned, I’m additionally shocked they didn’t go a step additional to resolve this problem. This implies there’s no easy technique to take a staging setting and synchronize it with manufacturing to go stay with a brand new theme.

How To Resolve This

There’s a answer to this, however it’s not a easy one. Import Export Suite for WooCommerce is the answer I’ve used and it makes this a way more manageable course of.

Step 1: Export Present Order Information out of your Manufacturing Atmosphere

Inside your manufacturing setting, you possibly can export every of the essential submit varieties. It’s also possible to make the most of superior filtering… like using the final order date in your staging space to solely embody orders after your information went out of sync.

Export WooCommerce Data

Step 2: Import Present Order Information to your Staging Atmosphere

After which you possibly can import that information within the default file format into your staging setting, making certain that you just don’t write over any present information within the database.

Import WooCommerce Data

Step 3: Resolve Conflicting IDs

Because the plugin iterates via data to import, it would report whether or not or not there are any conflicts on particular IDs. That is when it will get a bit tougher.

import history conflict id

Connecting on to the MySQL database, I needed to seek for these IDs within the wp_posts desk to determine what sort of report it was. If it was a web page or submit, I simply copied these to make sure they utilized a brand new ID. If it was one thing else, I needed to decide how one can cope with it.

NOTE: There’s an possibility with the plugin to replace the conflicting Order ID to a brand new Order ID. When you’re not involved with referencing older orders by ID, this feature makes the whole lot simpler. Nonetheless, should you’re seeking to help prospects, you’ll must seek for their order utilizing one thing apart from the ID!

As soon as I eradicated all conflicts, I re-imported the info and all data had been efficiently imported. As soon as the entire information conflicts had been resolved, I used to be in a position to push staging to manufacturing. A pleasant function of the plugin was that I didn’t should re-upload the import, I might simply rerun the import within the historical past tab.

re run import

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments