| 1 |
<?php |
| 2 |
/** |
| 3 |
* Shortcode. |
| 4 |
* |
| 5 |
* @package Welcart |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Direct into cart. |
| 10 |
* |
| 11 |
* @param array $atts Attributes. |
| 12 |
* @return usces_direct_intoCart |
| 13 |
*/ |
| 14 |
function sc_direct_intoCart( $atts ) { |
| 15 |
global $usces; |
| 16 |
extract( |
| 17 |
shortcode_atts( |
| 18 |
array( |
| 19 |
'item' => '', |
| 20 |
'sku' => '', |
| 21 |
'value' => null, |
| 22 |
'options' => null, |
| 23 |
), |
| 24 |
$atts |
| 25 |
) |
| 26 |
); |
| 27 |
|
| 28 |
if ( WCUtils::is_blank( $item ) || WCUtils::is_blank( $sku ) ) { |
| 29 |
return ''; |
| 30 |
} |
| 31 |
$post_id = $usces->get_ID_byItemName( $item ); |
| 32 |
|
| 33 |
return usces_direct_intoCart( $post_id, $sku, true, $value, $options, 'return' ); |
| 34 |
} |
| 35 |
|