I solve with this:
let product = await createProduct ( myProduct )
. then (( product ) => {
// product created
console . log ( “product created” , product );
productId = String ( product . _id );
})
. catch (( error ) => {
// product not created
console . error ( error )
});
setTimeout (()=>{
$w ( '#shoppingCartIcon1' ). addToCart ( productId )
. then (() => {
console . log ( "Product added" );
})
. **catch** (( error ) => {
console . log ( error );
});
}, 2000 );