Example #1
0
/**
 * Duplicate a product
 */
function ajax_duplicate_product()
{
    check_ajax_referer('wpshop_product_duplication', 'wpshop_ajax_nonce');
    $current_post_id = isset($_POST['current_post_id']) ? wpshop_tools::varSanitizer($_POST['current_post_id']) : null;
    $result = wpshop_entities::duplicate_entity_element($current_post_id);
    echo json_encode($result);
    die;
}