In SureCart, we automatically handle basic SEO tasks for you, such as generating product schema and meta tags. However, you also have the option to customize your own SEO settings if desired.

Disable SureCart Default SEO Meta

By default, SureCart includes well-optimized SEO meta tags for your documents and social media platforms like Facebook and Twitter.

If you wish to disable SureCart's default SEO (though it is generally not recommended unless you have added your own SEO meta tags), you can use the following filter hook:

add_filter( 'sc_display_product_seo_meta', '__return_false' );

Disable SureCart Default Product Schema

SureCart includes a default Product schema. If you prefer to use your own customized SEO product schema or integrate with third-party SEO solutions, you can disable the default schema using the following filter hook:

add_filter( 'sc_display_product_json_ld_schema', '__return_false' );

How to Add Customized Meta Tags

It's important to note that this step is generally unnecessary unless you have advanced knowledge of SEO or wish to implement highly customized SEO options using third-party plugins.

Instructions

  1. Disable SureCart Default SEO Meta Tags:
// Disable SureCart default SEO meta.
add_filter( 'sc_display_product_seo_meta', '__return_false' );
  1. Add Your Custom SEO Meta Tags:
// Hook into wp_head to add custom SEO meta tags.
add_action( 'wp_head', 'sc_add_customized_surecart_product_schema' );

function sc_add_customized_surecart_product_schema() {
    // Check if the current post is a single SureCart product.
    if ( ! is_singular('sc_product') ) {
        return;
    }

    // Get the active SureCart product if on the product detail page.
    $product = sc_get_product();

    // If there's no product found, exit the function.
    if ( empty( $product ) ) {
        return;
    }
    ?>
    
    <!-- Add custom meta tags -->
    <meta name="description" content="<?php echo esc_attr( sanitize_text_field( $product->meta_description ) ); ?>">
    <meta property="og:title" content="<?php echo esc_attr( $product->page_title ); ?>" />
    
    <!-- Add additional custom meta tags as needed -->
    
    <?php
}

This setup allows you to replace SureCart's default SEO meta tags with your customized ones, giving you full control over your SEO strategy.