← All changes
|
app/Hooks/Handlers/BlockEditors/ProductCardBlockEditor.php
+6
-12
1.3.21
→
1.6.6
View file →
| @@ -70,20 +70,14 @@ | ||
| 70 | 70 | if (!$product) { |
| 71 | 71 | return ''; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $selectedProductId = 'product_id=' . $product->ID; | |
| 75 | - | |
| 76 | - $selectedVariantId = ''; | |
| 77 | - if ($variationId = Arr::get($shortCodeAttribute, 'variant_id', false)) { | |
| 78 | - $selectedVariantId = 'variant_id=' . $variationId; | |
| 79 | - } | |
| 80 | - | |
| 81 | - $priceFormat = Arr::get($shortCodeAttribute, 'price_format', 'starts_from'); | |
| 82 | - $cardWidth = Arr::get($shortCodeAttribute, 'card_width', 216); | |
| 83 | - | |
| 84 | - $shortcodeName = ProductCardShortCode::getShortCodeName(); | |
| 85 | - return "[$shortcodeName $selectedVariantId $selectedProductId price_format=$priceFormat card_width=$cardWidth]"; | |
| 74 | + return ProductCardShortCode::make([ | |
| 75 | + 'product_id' => $product->ID, | |
| 76 | + 'variant_id' => Arr::get($shortCodeAttribute, 'variant_id', ''), | |
| 77 | + 'price_format' => Arr::get($shortCodeAttribute, 'price_format', 'starts_from'), | |
| 78 | + 'card_width' => Arr::get($shortCodeAttribute, 'card_width', 216), | |
| 79 | + ])->renderShortcode($block); | |
| 86 | 80 | } |
| 87 | 81 | |
| 88 | 82 | |
| 89 | 83 | |