Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function konte_woo_display_product_reviews () {
- global $product;
- if (true !== $product->get_reviews_allowed()) {
- return;
- }
- $lang = apply_filters('wpml_current_language', '');
- $forms = [
- 'el' => 1820,
- 'en' => 2393,
- ];
- $formId = $forms[$lang] ?? '';
- $productId = $product->get_id();
- $isVerificationDisabled = 'no' === get_option('woocommerce_review_rating_verification_required');
- $isVerifiedOwner = wc_customer_bought_product('', get_current_user_id(), $productId);
- echo '<span class="reviews-title">'.esc_html__('Reviews', 'konte-child').'</span>';
- echo do_shortcode("[site_reviews_summary assigned_posts='{$productId}' hide='rating']");
- echo do_shortcode("[site_reviews pagination='ajax' display='5' filters='true' assigned_posts='{$productId}' form='{$formId}']");
- if ($isVerificationDisabled || $isVerifiedOwner) {
- echo do_shortcode("[site_reviews_form assigned_posts='{$productId}' form='{$formId}']");
- } else {
- esc_html_e('Only logged in customers who have purchased this product may leave a review.', 'konte-child');
- }
- }
- add_action('woocommerce_after_single_product', 'konte_woo_display_product_reviews', 21);
- function konte_woo_remove_product_reviews_tab ($tabs) {
- unset($tabs['reviews']);
- return $tabs;
- }
- add_filter('woocommerce_product_tabs', 'konte_woo_remove_product_reviews_tab', 98);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement