Tổng hợp các đoạn code cho flatsome
The code snippets. Copy and Paste!
/**
* Remove Additional information
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 9999 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] );
return $tabs;
}
/**
* Remove related products
*/
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
/**
* Remove SKU
*/
function sv_remove_product_page_skus( $enabled ) {
if ( ! is_admin() && is_product() ) {
return false;
}
return $enabled;
}
add_filter( 'wc_product_sku_enabled', 'sv_remove_product_page_skus' );
/**
* Remove tags with CSS
*/
span.tagged_as {
display: none !important;
}
With selector:
div.product_meta > span.tagged_as {
display: none !important;
}
/**
* Remove product meta: tags, SKU and categories
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
/**
* Restore SKU
*/
add_action( 'woocommerce_single_product_summary', 'woo_show_sku_single_product', 40 );
function woo_show_sku_single_product() {
global $product;
?>
<div class="product_meta">
<?php if ( wc_product_sku_enabled() && ( $product->get_sku() || $product->is_type( 'variable' ) ) ) : ?>
<span class="sku_wrapper"><?php esc_html_e( 'SKU:', 'woocommerce' ); ?> <span class="sku"><?php echo ( $sku = $product->get_sku() ) ? $sku : esc_html__( 'N/A', 'woocommerce' ); ?></span></span>
<?php endif; ?>
</div>
<?php
}
/**
* Restore categories
*/
add_action( 'woocommerce_single_product_summary', 'woo_show_cats_again_single_product', 40 );
function woo_show_cats_again_single_product() {
global $product;
?>
<div class="product_meta">
<?php echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' ); ?>
</div>
<?php
}
Nhận xét
Đăng nhận xét