block.json
6 months ago
controller.php
6 months ago
index.asset.php
6 months ago
index.js
6 months ago
view.php
6 months ago
controller.php
22 lines
| 1 | <?php |
| 2 | |
| 3 | $product = sc_get_product(); |
| 4 | |
| 5 | // no product. |
| 6 | if ( empty( $product ) ) { |
| 7 | return; |
| 8 | } |
| 9 | |
| 10 | // reviews are not enabled. |
| 11 | if ( ! apply_filters( 'surecart/review_form/enabled', $product->reviews_enabled ) ) { |
| 12 | return; |
| 13 | } |
| 14 | |
| 15 | // Hide if there are no reviews at all (total_reviews = 0). |
| 16 | if ( empty( $product->total_reviews ) ) { |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | // return the view. |
| 21 | return 'file:./view.php'; |
| 22 |