탐색 건너뛰기

Waiting for author

Overview of the issue

When using Facebook for WooCommerce, clicking a translated product in Facebook redirects you to the product in the default language or to an error page.

Workaround

In your child theme functions.php file, add the following:

 
add_filter ('facebook_for_woocommerce_integration_prepare_product', 'fix_product_url', 11, 2);

 function fix_product_url($product_data, $id) {
	 $product_lang = apply_filters( 'wpml_post_language_details', null, $id );
	 $product_data['url'] = apply_filters( 'wpml_permalink', $product_data['url'], $product_lang['language_code'] );
	 return $product_data;
 }

Next steps to resolve this issue

We’ve contacted WooCommerce for a permanent fix, but have yet to hear back. Since the issue needs to be resolved with changes to the plugin code, we cannot assist any further other than by providing the workaround detailed above.

If you are experiencing issues and would like to push this fix forward to WooCommerce, feel free to leave a support ticket with the author here: https://woocommerce.com/my-account/create-a-ticket/ (you will need to be logged into WordPress.com).

6 응답 에게 “Facebook for WooCommerce - Links from Facebook to translated products do not work”

  1. Hello, in case it helps anyone.

    The code you posted doesn’t work for me, this one I show below does, I got it from the WPML forum.

    add_filter( ‘facebook_for_woocommerce_integration_prepare_product’, function( $product_data, $id ) {
    $product_lang = apply_filters( ‘wpml_post_language_details’, null, $id );

    $ref = array_key_exists( ‘url’, $product_data ) ? ‘url’ : ‘link’;

    $product_data[ $ref ] = apply_filters( ‘wpml_permalink’, $product_data[ $ref ], $product_lang[‘language_code’] );
    return $product_data;
    }, 11, 2 );

    • This code was proposed by one of our users and the only difference is that it first checks the URL coming from Facebook. If it works better for you, feel free to use it.
      Thank you for sharing it, Alexander. 🙂

    • Hello there,
      We work constantly with WooCommerce team. Thus, if you want to increase the priority of this issue, you can open a ticket as suggested in the “Next steps to resolve this issue” section.
      In the meantime, please use the workaround here proposed.
      Regards

  2. That’s what I did. Their employee said that he didn’t see any information on Github about this problem. Or did you notify Woo in some other way?

    • Our devs have other communication channels. As the errata explain, the goal is that you open a report in Github to better understand the priority of the issue.

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>