Creating Variable Price Product from Gravity
-
OK – any help would be appreciated, for some reason I’m not able to populate edd_variable_prices no matter how I structure the array. I need to be able to create a download within the context of another custom app –
I’m able to create the download post, but not populate the array – here is my code —
add_action(“gform_after_submission_27”, “create_download_from_submission”, 10, 2);
function create_download_from_submission($entry, $form)
{//First need to create the post in its basic form
$new_download = array(
‘post_title’ => ucwords($entry[5]),
‘post_status’ => ‘publish’,
‘post_date’ => date(‘Y-m-d H:i:s’),
‘post_type’ => ‘download’
);
//From creating it, we now have its ID
$theId = wp_insert_post($new_download);
//Now we add the metaupdate_post_meta($theId, _variable_pricing, ($entry[9]));
update_post_meta($theId, plan_property_id, ($entry[14]));//Create the Array for the Variable Product Prices
$array = array(
‘variableprice’ => array(
‘1’ => array(
‘index’ => 1,
‘name’ => “PDF”,
‘amount’ =>($entry[15])
),‘2’ => Array(
‘index’ => 2,
‘name’ => “CAD”,
‘amount’ =>($entry[17])
)
)
);$array = $_POST[‘variableprice’];
update_post_meta( $theID, _edd_variable_prices, $array );;
}Any help would be appreciated!
The topic ‘Creating Variable Price Product from Gravity’ is closed to new replies.