10up / distributor

Share content between your websites.
https://distributorplugin.com
GNU General Public License v2.0
628 stars 155 forks source link

Change the price of a product #1183

Open cdesp opened 7 months ago

cdesp commented 7 months ago

Describe your question

Hello,

i want to change the price of a product whenever it changes on the original, so the copied product will have a percentage of the original.

I tried like this and failed: `/**

add_filter( 'dt_push_post_meta', function( $a, $new_post_id, $post_meta, $post_id, $args, $connection ) {

// $fieldprefix =( $connection instanceof \Distributor\ExternalConnections\WordPressExternalConnection ) ? '' : 'post';

$post_meta[ '_regular_price'] = '45.55';
$post_meta[ '_sale_price'] = '34.55';
$post_meta[ 'post_regular_price'] = '645.55';
$post_meta[ 'post_sale_price'] = '634.55';

return true;

},10,6);

/**

any help will be appreciated.

Code of Conduct

cdesp commented 7 months ago

To anyone interesteed i manage to do what i wanted using this snippetQ ` /**