Product Variation Pills

Replace the standard WooCommerce product variation drop-downs with user-focused, mobile-friendly radio/pill buttons. Product Variation Pills let you design a cleaner product page and boost the user experience of your store!

Product Variation Pills plugin on a desktop monitor

Licences for this plugin need to be renewed annually.

SKU: N/A Category: Current: 2.2.3
money-back guarantee sticker


100% No-Risk, Money Back Guarantee!

We're excited to have you experience the power of our plugins. So over the next 14 days, if any Power Plugins aren’t the best fit for your project, simply reach out! We’ll happily refund 100% of your money. No questions asked.

About Product Variation Pills

Product Variation Pills is an easy way to replace the default WooCommerce variable-product drop-down lists with elegant pill buttons.

Just activate the plugin and you’re away – it works straight out of the box.

Product Variation Pills Example 1
Product Variations as Pill Buttons

Styling the Pills

The easiest way to configure the pill button colours is to to go Settings > Product Variation Pills and check the “Configure the pill colours here” option.

Each button has three states it can be in:

  • Off / unselected
  • On / Selected
  • Hover
Variation pill button color settings
Variation pill button colours

Manual Styling using CSS

Here’s a simple example of how to style the pills themselves. Either copy-and-paste this into your custom child theme’s style.css file, or paste it into the Additional CSS in the Customizer. Change the colours to suit your site.

/* Unselected / off */
.pv-pills .pill {
	border: 1px solid grey;
	border-radius: 0.5em;
	transition: 0.3s background-color;
}

/* Selected / on */
.pv-pills .pill input[type="checkbox"]:checked+label {
	background-color: purple;
	color: white;
}

/* Hover */
.pv-pills .pill label:hover {
	border: 1px solid black;
}

Enable / Disable Pills Dynamically

If you need to disable Product Variation Pills for one or more of your products, you can hook the pvp_is_active filter. Copy and paste this example into your custom child theme’s functions.php and change the values in $disable_for_ids for your products.

/**
 * COnditionally disable PV Pills for some products.
 */
function custom_pvp_is_active($is_active) {
    $product = get_product();

    // Product IDs where you don't want Product Variation Pills.
    $disable_for_ids = array(1234, 9876);

    if (in_array($product->get_id(), $disable_for_ids)) {
        $is_active = false;
    }

    return $is_active;
}
add_filter('pvp_is_active', 'custom_pvp_is_active');

Actions & Filters

HookParametersNotes
pvp_is_active
filter
$is_activeReturns true on single product pages if WooCommerce is installed. You can return false from this if you need to disable pill mode for some products.
pvp_refresh_delay
filter
$delayThe delay between the page loading and PV Pills initialising, in milliseconds. Default: 50
pvp_heartbeat_interval
filter
$intervalPV Pills runs a heartbeat in the browser to check that the pills are not out-of-sync with what WooCommerce thinks is selected. This configures the heartbeat interval in milliseconds. Default: 250
pvp_enable_diagnostics
filter
$is_enabledReturn true from this filter if you want to see WooCommerce’s original drop-down selectors. This can be useful when trying to understand unexpected behaviour.
before_enqueue_pvpills_scripts
action
Fires immediately before the PV Pills enqueues its scripts and styles.
after_enqueue_pvpills_scripts
action
Fires immediately after the PV Pills enqueues its scripts and styles.
pvpill_label_text
filter
$pill_label_text,
$term,
$attribute_name
The text that’s used for individual pills. By default, $pill_label_text will contain $term->name. This gets sanitised through esc_html so if you want to inject HTML into the pills, you should use pvpill_label_html instead.
pvpill_label_html
filter
$pill_label_html,
$term,
$attribute_name
The raw HTML that gets inserted inside the pills. By default, this is esc_html($term->name).
PV Pills : WordPress action & filter hooks

Changelog: Product Variation Pills

Version 2.2.3

Released: 2022-09-08

Fixed a bug when using custom attributes as variations, when the custom attribute terms had double-quotes in them.

Version 2.2.2

Released: 2022-08-30

Better handling of when the user clicks the "Clear" button when viewing a product variation.

Version 2.2.0

Released: 2022-08-16

Added a new feature so you can override the Ajax variations threshold. If you've got products with a large number of variations and you can select invalid product combinations with "Sorry, no products matched your selection. Please choose a different combination.", this new option lets you set a higher threshold... which means you can use a higher number of variation combinations in your variable products.

Older releases

Added colour pickers to the settings page so you can style the pill buttons without using CSS.

Fixed a bug when certain types of attribute term slugs could cause an element-select query crash.

Update the Power Plugins support library.

Extended the "auto-select singletons" option so it'll try to auto-select pills whenever possible. It makes for a more intuitive user experience when selecting product variations.

Added a new options to control enable auto-select of variations when only one pill is available.

Modified the front-end pill-select logic to play nicer when multiple product attributes are available.

  • Minor update and package-rebuild.
  • Added some new actions and filters.
  • Tidied up the CSS a little.

NEW HOOKS

  • do_action( 'before_enqueue_pvpills_scripts' ) fires before the PV Pills scripts/css are enqueued.
  • do_action( 'after_enqueue_pvpills_scripts' ) fires before the PV Pills scripts/css are enqueued.
  • add_filter( 'pvpill_label_text', $pill_label_text, $term, $attribute_name) lets you override the text inside the pills.
  • add_filter( 'pvpill_label_html', $pill_label_html, $term, $attribute_name) lets you override the raw HTML that is rendered inside the pills.
  • Integrate with Power Plugins updates.
  • Minor code refactoring.
  • Added a new function is_pvpills_frontend_required() that can be used to see if PV Pills will be used on the current page.
  • Minor update
  • Restructured source files. Cleaner.
  • Added support for custom product attributes (as variations).
  • New logic for the frontend. More robust.
  • Easier to override styles at theme-level.
  • Detect singleton options (terms) and auto-select them.
  • Integration with proper update checking and change log.
  • Initial development release.

Reviews

There are no reviews yet.

Be the first to review “Product Variation Pills”