WooCommerce: Bulk Updating Products with WP CLI

A vibrant display of beer crates stacked in a warehouse, showcasing various brands.

In a recent Business Bloomer Club Slack thread, a user sought help with bulk updating products using WP CLI after importing over 500 products via WP All Import. While the import process was successful, an issue persisted: the product breadcrumbs were still showing the old product category.

Interestingly, the problem was resolved simply by resaving the product, even without making any changes. The user was looking for a more efficient way to trigger this update for all products without manually saving each one.

WP CLI is a powerful tool for WordPress users, providing a command-line interface for managing WordPress sites. It can be used to perform bulk updates and automate various tasks, including product updates for WooCommerce. However, WP CLI doesn’t natively support product imports or updates with WP All Import, and the specific issue of re-saving products to refresh breadcrumbs required some creative thinking.

Continue reading WooCommerce: Bulk Updating Products with WP CLI

WooCommerce: Adding Variation Price Editing to Quick Edit

ice cream, gelato, summer

In a recent Business Bloomer Club discussion, a user with exclusively variable products faced a challenge: editing variation prices via the Quick Edit functionality.

By default, WooCommerce Quick Edit doesn’t support variable product prices, as it’s primarily built for simple products.

If you’re ready to dive into custom PHP and JavaScript, this post outlines how you can approach adding variation price editing to the Quick Edit feature.

Continue reading WooCommerce: Adding Variation Price Editing to Quick Edit

Deleting WooCommerce Product Images by Attribute: A Safe Approach

In a recent Business Bloomer Club thread, a member encountered an issue while attempting to remove images from WooCommerce products with a specific attribute. The function they initially wrote ended up deleting images from all products, which wasn’t the intended outcome. This post explores how to safely delete product images based on specific attributes and ensure that only products matching the criteria are affected.

The user’s goal was to remove images only from products with a particular attribute, such as the brand. However, the initial code used wc_get_products with unsupported parameters (attribute and attribute_term), resulting in an error that applied the action to all products. Below is a revised version of the function, which ensures only products with a specific attribute are affected by first checking for the attribute term in each product.

Continue reading Deleting WooCommerce Product Images by Attribute: A Safe Approach