Quantcast
Channel: PHP
Viewing all articles
Browse latest Browse all 28

Woocommerce Product Add-ons - Auto-select first option

$
0
0
The agency I work for are trying to get a client's website to auto-select the first option on the maintenance packages for their products.

Currently, we are using an if statement within a foreach.

The code below is the script we are currently using:

PHP:
<?php foreach ( $addon['options'] as $i => $option ) :

                $price         = $option['price'] > 0 ? '(' . wc_price( get_product_addon_price_for_display( $option['price'] ) ) . ')' : '';
                $current_value = 0;...
Woocommerce Product Add-ons - Auto-select first option

Viewing all articles
Browse latest Browse all 28

Trending Articles