You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 29, 2022. It is now read-only.
Alexander Zaets edited this page Jun 15, 2021
·
2 revisions
//can be done without product, sku id is enough
/* @var $product Product */
$product = Yii::$app->bluesnap->getProductModel(
[
'and',
['=', 'product_id', $productId]
]
);
if (!empty($product)) {
$product = reset($product);
}
/*
* in current case product contain only 1 sku.
* if u created more - make sure u working with correct one
*/
$skus = $product->getSkus();
$sku = reset($skus);
//mandatory part
$cart = Yii::$app->bluesnap->cart;
$cart->addSku($sku->sku_id, 1);
$link = $cart->proceedToBuyNow($shopperId);
//use link for redirecting user to checkout page