Giúp mình thay đổi vị trí hiển thị của sản phẩm liên quan (Product Related) trong phần chi tiết sản phẩm như thế nào vậy. Hiện tại nó đang ở dưới nội dung content, mình vào code thì thấy nó ghi như dưới, có phải đó là thứ tự hiển thị không? làm sao thay đổi thứ tự này. Mã: * @hooked woocommerce_output_product_data_tabs - 10 * @hooked woocommerce_upsell_display - 15 * @hooked woocommerce_output_related_products - 20 Như hình dưới, mình muốn đổi thứ tự hiện thị nó từ dưới lên trên chỗ tab product như hình mình vẽ thì làm như thế nào? Mình xài themes Flatsome phiên bản mới nhất
Mấy cái hooked number đó đúng là vị trí hiện thị ha bạn, hay còn gọi là thứ tự gọi code của web, cái nào được gọi trước thì nó cho hiển thị trước. Để thay đổi thứ tự này bạn add code sau vào function.php của themes nhé: Mã: remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 5 ); Các vị trí thay đổi khác bạn tham khảo: Mã: remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 ); remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 ); remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 ); remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 ); remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); remove_action( 'woocommerce_archive_description', 'woocommerce_product_archive_description', 10 );