block.json
3 months ago
bundle.php
1 week ago
controller.php
1 month ago
index.asset.php
6 days ago
index.js
6 days ago
radio.php
1 month ago
select.php
1 month ago
style-index-rtl.css
1 month ago
style-index.css
1 month ago
view.php
3 months ago
controller.php
22 lines
| 1 | <?php |
| 2 | // Get product from initial state. |
| 3 | $product = sc_get_product(); |
| 4 | |
| 5 | if ( empty( $product->id ) ) { |
| 6 | return; |
| 7 | } |
| 8 | |
| 9 | // Bundle product: render a picker per component option in a dedicated view. A |
| 10 | // bundle has no variants of its own — its component products carry the variants. |
| 11 | if ( ! empty( $product->bundle ) ) { |
| 12 | return empty( $product->bundle_items->data ) ? '' : 'file:./bundle.php'; |
| 13 | } |
| 14 | |
| 15 | // Normal product: needs its own variant options to render anything. |
| 16 | if ( empty( $product->variant_options->data ) ) { |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | // return the view. |
| 21 | return 'file:./view.php'; |
| 22 |