File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ foreach ($products as $product) {
56
56
$shipping->setService('UPS Express');
57
57
$shipping->setPrice('1300 USD');
58
58
$item->setShipping($shipping);
59
+
60
+ // Set a custom shipping label and weight (optional)
61
+ $item->setShippingLabel('ups-ground');
62
+ $item->setShippingWeight('2.14');
63
+
64
+ // Set a custom label (optional)
65
+ $item->setCustomLabel('Some Label 1', 0);
66
+ $item->setCustomLabel('Some Label 2', 1);
59
67
60
68
// Add this product to the feed
61
69
$feed->addProduct($item);
Original file line number Diff line number Diff line change @@ -341,6 +341,46 @@ public function addShipping($shipping)
341
341
return $ this ;
342
342
}
343
343
344
+ /**
345
+ * Add shipping label
346
+ *
347
+ * @param string $str
348
+ *
349
+ * @return $this
350
+ */
351
+ public function setShippingLabel ($ str )
352
+ {
353
+ $ this ->setAttribute ('shipping_label ' , $ str , false );
354
+ return $ this ;
355
+ }
356
+
357
+ /**
358
+ * Add shipping weight
359
+ *
360
+ * @param string $str
361
+ *
362
+ * @return $this
363
+ */
364
+ public function setShippingWeight ($ str )
365
+ {
366
+ $ this ->setAttribute ('shipping_weight ' , $ str , false );
367
+ return $ this ;
368
+ }
369
+
370
+ /**
371
+ * Set a custom label
372
+ *
373
+ * @param string $str
374
+ * @param integer $pos
375
+ *
376
+ * @return $this
377
+ */
378
+ public function setCustomLabel ($ str , $ pos )
379
+ {
380
+ $ this ->setAttribute ('custom_label_ ' . $ pos , $ str , false );
381
+ return $ this ;
382
+ }
383
+
344
384
/**
345
385
* @param $namespace
346
386
*
You can’t perform that action at this time.
0 commit comments