関数
ItemPage::filterAddToCartButton( string $html )
Add to Cart input name with wcexicsAddToCart for custom processingパラメータ パラメータ
- $html
(文字列) (必須)
ファイル: src/Pages/ItemPage/ItemPage.php
public static function filterAddToCartButton($html) {
global $usces, $post;
$comboset = ComboSet::getComboSetFromSkuCode($post->ID, $usces->itemsku['code']);
if ($comboset instanceof GenericError) {
return $html;
}
if (empty($comboset->getGroups())) {
return $html;
}
$empty = true;
foreach ($comboset->getGroups() as $group) {
if (!empty($group->getItems())) {
$empty = false;
break;
}
}
if ($empty === true) {
return $html;
}
$id = $comboset->getId();
$html = preg_replace('/name="inCart/', 'data-combo-set-id="' . $id . '" name="wcexicsAddToCart', $html);
return $html;
}