Ajouter les attributs des variations dans le codebar openpos woocommerce

Il suffit de créer un shortcode dans lequel on récupère les différents attributs. Vous pouvez copier le code dans le function.php de votre child theme. Ensuite vous pourrez ajouter le shortcode [op_get_subtitle_attribut] dans le configurateur.

https://codecanyon.net/item/openpos-a-complete-pos-plugins-for-woocomerce/22613341

function shortcode_title_subproduct(){
	global $_op_product;
	$sub_title = "";
	$_product = wc_get_product($_op_product->get_id());
	if($_product->get_type() == 'variation')
	{
		$variation_attributes = $_product->get_attributes();
		$variation_label_attributes = array();
		foreach($variation_attributes as $vk =>$v)
		{
			$variation_label_attributes[] = $_product->get_attribute($vk);

		}

		$sub_title = ' - '.implode(',',$variation_label_attributes).'';
	}
	return $sub_title;
}
add_shortcode('op_get_subtitle_attribut', 'shortcode_title_subproduct');

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.