ASTRA_Ext_WooCommerce_Markup::single_product_variations_custom_html( string $html, array $args )

Single Product Select to Button Markup.


Description


Parameters

$html

(string) (Required) old select html populated by WooCommerce.

$args

(array) (Required) variation arguments.


Return

(mixed) $html


Source

File: addons/woocommerce/classes/class-astra-ext-woocommerce-markup.php

		public function single_product_variations_custom_html( $html, $args ) {
			echo $html;  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			?>
				<div class="ast-variation-button-group">
				<?php
				if ( isset( $args['options'] ) ) {
					foreach ( $args['options'] as $slug ) {
						$term = get_term_by( 'slug', $slug, $args['attribute'] );
						$name = ! empty( $term->name ) ? $term->name : $slug;
						?>
						<div class="ast-single-variation" data-slug="<?php echo esc_attr( $slug ); ?>" >
						<?php echo esc_attr( $name ); ?>
						</div>
						<?php
					}
				}
				?>
				</div>
			<?php
		}

Changelog

Changelog
Version Description
3.9.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.