Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
fixes #348 by assigning language to variations
Browse files Browse the repository at this point in the history
this allows variations to be included as expected in product exports
for example
  • Loading branch information
Jon007 committed Aug 19, 2018
1 parent 1d83ef2 commit 51898f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Hyyan/WPI/Product/Variation.php
Expand Up @@ -160,6 +160,7 @@ protected function insert(\WC_Product_Variation $variation, array $metas)
$data['post_parent'] = $this->to->get_id();
$ID = wp_insert_post($data);
if ($ID) {
pll_set_post_language( $ID, pll_get_post_language( $this->to->get_id() ) );
update_post_meta(
$ID, self::DUPLICATE_KEY, $metas['variation_id']
);
Expand All @@ -176,6 +177,7 @@ protected function insert(\WC_Product_Variation $variation, array $metas)
protected function update(\WC_Product_Variation $variation, \WP_Post $post, array $metas)
{
$this->copyVariationMetas($variation->get_id(), $post->ID);
pll_set_post_language( $post->ID, pll_get_post_language( $post->post_parent ) );
}
/**
* Add duplicate meta key to products created before plugin activation.
Expand Down

0 comments on commit 51898f9

Please sign in to comment.