Yeni nesil Webmaster Forumuna hoş geldin

Sen de aramıza katıl!

Üye ol

WooCommerce'de Satıcı İade ve Kargo Politikası Nasıl Eklenir?

WebCode

ekip
Katılım
13 Ağu 2024
Mesajlar
197
Tepkime puanı
35
Bir WooCommerce mağazası işletiyorsanız, Şema işaretlemenize bir Tüccar İade ve Kargo politikası eklemek zengin snippet'inizi daha da geliştirecektir. Google, Google Search Console, Merchant Center vb. dahil olmak üzere bu verileri eklemenin birkaç yolunu sunar ve Şema İşaretlemesi bunlardan biridir.

Bu bilgi bankası makalesinde, bu zengin sonuçlara hak kazanmak için Rank Math'i kullanarak bunları Çevrimiçi Mağazanıza nasıl ekleyeceğinizi açıklayacağız.

Merchant-Return-Policy-rich-snippet-scaled-e1721287561663.jpg

Tüccar iade politikasını hem Kuruluş düzeyinde hem de ürün düzeyinde ekleyebilirsiniz. Ancak, ürün düzeyindeki işaretlemenizin kuruluş düzeyindeki işaretlemenizi geçersiz kılacağını unutmayın .

Not: Başlamadan önce, Şema modülünüzün Rank Math → Dashboard → Modules bölümünde etkinleştirildiğinden emin olun .

Rank Math SEO → Schema Templates'a giderek başlayın ve ardından buradaki Yeni Şema Ekle düğmesine tıklayın . Ekranda görünen açılır pencerede Custom Schema Builder'ı seçin.

Özel Şema Oluşturucu

Daha sonra Şema Oluşturucu'da, Özellik Ekle ve Özellik Grubu Ekle seçeneklerini kullanarak MerchantReturnPolicy Şeması'nı aşağıda gösterildiği gibi ekleyin .

Lütfen değerleri web sitenize göre ayarlamakta özgürsünüz. Ayrıca bu Şemayı yapılandırmak için Google'ın belgelerine de başvurabilirsiniz .

Tüccar İade Politikası

Daha sonra, aşağıda gösterildiği gibi, bu özel Şemayı Kuruluş Şemasına Eklemeyi seçebileceğiniz Görüntüleme Koşulları sekmesine gidin . Son olarak , Kaydet düğmesine tıklayın.

Set-display-condition-for-return-policy.jpg

Ürün Düzeyinde Tüccar İade ve Kargo Politikası Nasıl Eklenir​

Ürün düzeyinde Tüccar İade ve Kargolama politikasını eklemek için, aşağıdaki filtreyi web sitenizin tema dosyasına ekleyebilirsiniz . Daha önce bir dosya rank-math.phpoluşturmadıysanız , bir tane oluşturmak için bu eğitime başvurabilirsiniz .rank-math.php

Lütfen filtreyi WooCommerce mağazanızla ilgili değerlerle özelleştirmekten çekinmeyin. Kabul edilen değerleri anlamak için Google'ın bu belgelerine başvurabilirsiniz .

Aşağıdaki filtre, bu Satıcı İade ve Kargo politikasını tüm basit ürünlerinize ekler, ancak bu filtreyi belirli ürünler için değiştirmek üzere koşullarla daha da özelleştirebilirsiniz.

Kod:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {

    // Return policy

    $entity['offers']['hasMerchantReturnPolicy']['@type'] = 'MerchantReturnPolicy';

    $entity['offers']['hasMerchantReturnPolicy']['applicableCountry'] = 'US';

    $entity['offers']['hasMerchantReturnPolicy']['returnPolicyCountry'] = 'US';

    $entity['offers']['hasMerchantReturnPolicy']['returnPolicyCategory'] = 'https://schema.org/MerchantReturnFiniteReturnWindow';

    $entity['offers']['hasMerchantReturnPolicy']['merchantReturnDays'] = 7;

    $entity['offers']['hasMerchantReturnPolicy']['returnMethod'] = 'https://schema.org/ReturnByMail';

    $entity['offers']['hasMerchantReturnPolicy']['returnFees'] = 'https://schema.org/FreeReturn';

    $entity['offers']['hasMerchantReturnPolicy']['refundType'] = 'https://schema.org/FullRefund';



    // Shipping details

    $entity['offers']['shippingDetails']['@type'] = 'OfferShippingDetails';

    $entity['offers']['shippingDetails']['shippingRate']['@type'] = 'MonetaryAmount';

    $entity['offers']['shippingDetails']['shippingRate']['value'] = 5;

    $entity['offers']['shippingDetails']['shippingRate']['currency'] = 'USD';

    $entity['offers']['shippingDetails']['shippingDestination']['@type'] = 'DefinedRegion';

    $entity['offers']['shippingDetails']['shippingDestination']['addressCountry'] = 'US';

    $entity['offers']['shippingDetails']['deliveryTime']['@type'] = 'ShippingDeliveryTime';

    $entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['@type'] = 'QuantitativeValue';

    $entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['minValue'] = 0;

    $entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['maxValue'] = 1;

    $entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['unitCode'] = 'DAY';

    $entity['offers']['shippingDetails']['deliveryTime']['transitTime']['@type'] = 'QuantitativeValue';

    $entity['offers']['shippingDetails']['deliveryTime']['transitTime']['minValue'] = 0;

    $entity['offers']['shippingDetails']['deliveryTime']['transitTime']['maxValue'] = 3;

    $entity['offers']['shippingDetails']['deliveryTime']['transitTime']['unitCode'] = 'DAY';

    return $entity;

});

Ancak değişken ürünleriniz varsa, bu Satıcı İade ve Kargo politikasını bunlara eklemek için aşağıdaki filtreyi kullanabilirsiniz. Bu filtreyi yine de özel olarak özelleştirebilirsiniz.



add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {

    if ( empty( $data['richSnippet'] ) || ! in_array( $data['richSnippet']['@type'], [ 'Product', 'ProductGroup' ] ) ) {

        return $data;

    }



    $data['shippingDetails'] = [

        '@context'     => 'https://schema.org/',

        '@type'        => 'OfferShippingDetails',

        '@id'          => '#shipping_policy',

        'deliveryTime' => [

            '@type'        => 'ShippingDeliveryTime',

            'handlingTime' => [

                '@type'    => 'QuantitativeValue',

                'minValue' => 0,

                'maxValue' => 1,

                'unitCode' => 'DAY',

            ],

            'transitTime' => [

                '@type'    => 'QuantitativeValue',

                'minValue' => 1,

                'maxValue' => 5,

                'unitCode' => 'DAY'

            ],

        ],

        'shippingRate' => [

            '@type'    => 'MonetaryAmount',

            'value'    => 200,

            'currency' => 'PKR',

        ],

        'shippingDestination' => [

            '@type' => 'DefinedRegion',

            'addressCountry' => 'PK'

        ]

    ];

    $data['hasMerchantReturnPolicy'] = [

        '@context'     => 'https://schema.org/',

        '@type'        => 'MerchantReturnPolicy',

        '@id'          => '#merchant_policy',

        'applicableCountry' => 'PK',

        'returnPolicyCategory' => 'https://schema.org/MerchantReturnFiniteReturnWindow',

        'merchantReturnDays' => 7,

        'returnMethod' => 'https://schema.org/ReturnByMail',

        'returnFees' => 'https://schema.org/FreeReturn'

    ];

    if ( 'Product' ===  $data['richSnippet']['@type'] ) {

        $data['richSnippet']['offers']['shippingDetails'] = [ '@id' => '#shipping_policy' ];

        $data['richSnippet']['offers']['hasMerchantReturnPolicy'] = ['@id' => '#merchant_policy'];

        return $data;

    }



    if ( empty( $data['richSnippet']['hasVariant'] ) ) {

        return $data;

    }



    foreach ( $data['richSnippet']['hasVariant'] as $key => $value ) {

        if ( empty( $value['offers'] ) ) {

            continue;

        }



        $data['richSnippet']['hasVariant'][ $key ]['offers']['shippingDetails'] = [ '@id' => '#shipping_policy' ];

        $data['richSnippet']['hasVariant'][ $key ]['offers']['hasMerchantReturnPolicy'] = [ '@id' => '#merchant_policy' ];

    }



    return $data;



}, 99, 2);
Ve işte bu kadar!
 
Anasayfa Üye ol Giriş yap