As we know WooCommerce product
attributes are stored in a custom taxonomy, It means we need to work with taxonomies
and terms instead of posts. WP-CLI
provides commands for working with taxonomies
and terms that can be used for this purpose.
We are going to follow the given steps:
List all global product attributes > Delete all terms in each global attribute taxonomy
We will use the given CLI to list out all taxonomies so we can identify our attribute taxonomies.
wp taxonomy list --format=json | jq '.[] | select(.name | startswith("pa_"))'
We will use given CLI to delete all terms we have in a specific taxonomy.
wp term list pa_color --field=term_id | xargs wp term delete pa_color
Here we need to replace pa_color
with the actual taxonomy
you want to delete
terms from.
Related Posts:
- Categories not shown in admin after adding woocommerce products via wp wc cli
- WP WPQuery, not running properly in WP CLI
- Skip WooCommerce 4.5.x onboarding with WP-CLI [closed]
- How to delete 1000s of duplicated images in WordPress?
- Setting stock levels to “0” for all products in store using WP CLI
- How to add a new endpoint in woocommerce
- Slow Loading Attribute Select – WooCommerce Backend
- How can I define a custom template for woocommerce [products] shortcode? [closed]
- Use Hooks to Limit One Comment Per User Per Post – Hide Form if Already Commented
- Display Categories Assigned to a WooCommerce Product
- Get current WooCommerce endpoint not working
- Changing Woocommerce price display [closed]
- Set a default quantity input value for a variable product category in WooCommerce
- WooCommerce product sorting VERY slow
- WooCommerce change price in cart [closed]
- Woocommerce – Move product without price a the end
- Enabling autosave when plugin disabled
- WooCommerce email text based on category && shipping zone && payment method [closed]
- Extra row / text field to a product page (WooCommerce)
- woocommerce_email_attachments filter arguments [closed]
- Problem with cURL and rest API
- Woocommerce checkout page reload on up dating shipping method
- change wp_login url and redirect users at the same time
- How to clear woocommerce checkout form after pageload
- Is there a plugin available for recurring orders in Woocommerce? [closed]
- Woocommerce PHP site that shows table with orders from specific category
- Send billing info from woocommerce checkout page to paypal checkout form
- Check if a category has a parent category in WooCommerce REST API
- Remove a higher quantity from stock according to a variation
- Auto generate user email while registration
- WooCommerce Cart Total Table chronology order change [closed]
- Woocommerce Update Order Notes Date
- Shipping Method does not inherit settings from the class
- My woocommerce checkout page and woocommerce setting page are not responding [closed]
- Switch position of short description and variations [closed]
- Get specific values in Woocommerce Rest API
- Javascript error when adding an item to the cart [closed]
- Woocommerce: Complex query in pre_get_posts [closed]
- How can I get all the woocommerce api orders [closed]
- Switch to user link
- Customize WooCommerce Add To Cart Form Name [closed]
- Remove WooCommerce block styles
- Can’t find a product by SKU
- Weird strange letters appeared in all website links [duplicate]
- password_reset doesnt work
- How can I edit the Woocommerce product widget html class?
- WooCommerce Cart Items
- Can’t show Woocommerce product category description
- Display vendor phone number on single product page
- 3 Different Prices for Woocommerce Product
- Retrieve Data from Custom Endpoint
- Online wc-blocks-style.css rendering instead of the hosted wc-blocks-style.css
- Use ID as slug for product category by default in WooCommerce?
- I have 3 types of prices in WP and I need to change price for each specific user role using hooks
- How do I display only the relevant attributes?
- How to add php variable inside wc_enqueue_js(‘jQuery’) function?
- Show menu order field in quick edit
- Adapt shipping surcharge code [closed]
- How to remove the Sub category product URL Woocommerce
- WC_Structured_Data Class Causing Needless Translation
- Placing Lock Icon on WooCommmerce “Place Order” Checkout Button (WordPress ‘ignoring’ Changes…)
- How to Sync Woocommerce and CRM via External API
- Add sale count next to star rating in woocommerce single product page
- How do i display zip code options during checkout [closed]
- Woocommerce – wc_cart_totals_shipping_method_label() breaking out option tag
- Woocommerce Add prices
- How to limit Woocommerce search to titles only?
- How to invoice Woocommerce customer the remainder balance amount for additional items to an already paid order
- WooCommerce – Show different terms and conditions for different user roles
- How to set subcategory in Woocommerce?
- Woocommerce – How to Show product tags in shop page
- Bulk edit orders to ‘wc-processing’ status
- WordPress user ID prefix
- After update Woocommerce shop page not showing products
- Remove link for Woocommerce product tags
- WooCommerce Class dosen’t exist
- Problem in woocommerce.The option “Add product image” is gone.Please help me!
- How to make product free for some customers and paid for others?
- WooCommerce – different icons for product categories
- WordPress returning “XHR” even when access keys are used
- Woocommerce: Some action hooks not firing inside class [closed]
- How to move WooCommerce Product Data Box below Title Box in Edit
- Custom access given to Admin dashboard
- WooCommerce, after moving reviews tab to under product description. If pagination link is clicked description is hidden
- Is it possible to hide certain products from displaying in the search results
- WordPress Woocommerce product-category info on one line [closed]
- Woocommerce | Product page seems differently on my 2 websites
- How to get products outside main loop in Woocommerce?
- WooCommerce shipping tax
- Login page so wide [closed]
- My custom button to add an item in the WooCommerce admin page doesn’t refresh the page
- Add field to category woocommerce page
- WordPress Pagination products with AJAX
- How to fetch More Offers products in WooCommerce?
- How do I use a combination of switch_to_blog() and wc_create_order()?
- Variation swatches problem in woodomart theme (title of swatch and box are appearing together) [closed]
- sidebar cart page
- Getting error – preview cannot be loaded when activating WooCommerce plugin [closed]
- Woocommerce template not working on newly added products
- Woocommerce ajax search can’t work on mobile