Add product custom options in rest/V1/ordersExport custom option via REST interfaceRest API - how to get custom attributesTrying to add an order_item attribute into the REST APIHow to get the bundle product options via SOAP api?Magento 2 rest api - get orders with products' custom attributesHow to create complex search filters while doing a GET on sales orders through Magento 2 REST API?how to use Search rest api in magento 2?Trying to add product with description via RESTMagento2: Get all orders using REST API?Get pending orders for a specific customer using REST API Magento 2Problem adding attribute options to configurable product via REST Api
Good introductory book to type theory?
Why doesn't a particle exert force on itself?
Does every non-empty set admit an (affine) scheme structure (in ZFC)?
Extracting the parent, leaf, and extension from a valid path
Does it make sense to start saving into a 401k, if you might move out of the US before retirement?
How is it believable that Euron could so easily pull off this ambush?
While drilling into kitchen wall, hit a wire - any advice?
Why can’t you see at the start of the Big Bang?
How to increase row height of a table and vertically "align middle"?
How do I minimise waste on a flight?
What's weird about Proto-Indo-European Stops?
Game artist computer workstation set-up – is this overkill?
Scaling rounded rectangles in Illustrator
Does this website provide consistent translation into Wookiee?
shebang or not shebang
Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?
Musical Shape on music stand
Can you just subtract the challenge rating of friendly NPCs?
My C Drive is full without reason
I want to write a blog post building upon someone else's paper, how can I properly cite/credit them?
LiOH hydrolysis of methyl 2,2-dimethoxyacetate not giving product?
Why did Dr. Strange keep looking into the future after the snap?
Is throwing dice a stochastic or a deterministic process?
Clauses with 3 infinitives at the end
Add product custom options in rest/V1/orders
Export custom option via REST interfaceRest API - how to get custom attributesTrying to add an order_item attribute into the REST APIHow to get the bundle product options via SOAP api?Magento 2 rest api - get orders with products' custom attributesHow to create complex search filters while doing a GET on sales orders through Magento 2 REST API?how to use Search rest api in magento 2?Trying to add product with description via RESTMagento2: Get all orders using REST API?Get pending orders for a specific customer using REST API Magento 2Problem adding attribute options to configurable product via REST Api
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to get product custom options in ordered items by rest/V1/orders.
If i use searchCriteria, i received all custom options 
but in another way i can't resieved custom options. Which method i must extend ?
magento2 api
|
show 1 more comment
I want to get product custom options in ordered items by rest/V1/orders.
If i use searchCriteria, i received all custom options 
but in another way i can't resieved custom options. Which method i must extend ?
magento2 api
Did you find a solution?
– Alex
Sep 24 '18 at 8:33
@Alex yes i found
– omelandr
Sep 25 '18 at 9:03
like this ? magento.stackexchange.com/questions/243442/… @omelandr
– Alex
Sep 25 '18 at 10:15
1
@Alex yes, extenison attributes see my answer
– omelandr
Sep 25 '18 at 13:35
@omelandr this does not work for me .....
– Kashif
May 3 at 14:12
|
show 1 more comment
I want to get product custom options in ordered items by rest/V1/orders.
If i use searchCriteria, i received all custom options 
but in another way i can't resieved custom options. Which method i must extend ?
magento2 api
I want to get product custom options in ordered items by rest/V1/orders.
If i use searchCriteria, i received all custom options 
but in another way i can't resieved custom options. Which method i must extend ?
magento2 api
magento2 api
asked Jan 9 '18 at 10:13
omelandromelandr
6071822
6071822
Did you find a solution?
– Alex
Sep 24 '18 at 8:33
@Alex yes i found
– omelandr
Sep 25 '18 at 9:03
like this ? magento.stackexchange.com/questions/243442/… @omelandr
– Alex
Sep 25 '18 at 10:15
1
@Alex yes, extenison attributes see my answer
– omelandr
Sep 25 '18 at 13:35
@omelandr this does not work for me .....
– Kashif
May 3 at 14:12
|
show 1 more comment
Did you find a solution?
– Alex
Sep 24 '18 at 8:33
@Alex yes i found
– omelandr
Sep 25 '18 at 9:03
like this ? magento.stackexchange.com/questions/243442/… @omelandr
– Alex
Sep 25 '18 at 10:15
1
@Alex yes, extenison attributes see my answer
– omelandr
Sep 25 '18 at 13:35
@omelandr this does not work for me .....
– Kashif
May 3 at 14:12
Did you find a solution?
– Alex
Sep 24 '18 at 8:33
Did you find a solution?
– Alex
Sep 24 '18 at 8:33
@Alex yes i found
– omelandr
Sep 25 '18 at 9:03
@Alex yes i found
– omelandr
Sep 25 '18 at 9:03
like this ? magento.stackexchange.com/questions/243442/… @omelandr
– Alex
Sep 25 '18 at 10:15
like this ? magento.stackexchange.com/questions/243442/… @omelandr
– Alex
Sep 25 '18 at 10:15
1
1
@Alex yes, extenison attributes see my answer
– omelandr
Sep 25 '18 at 13:35
@Alex yes, extenison attributes see my answer
– omelandr
Sep 25 '18 at 13:35
@omelandr this does not work for me .....
– Kashif
May 3 at 14:12
@omelandr this does not work for me .....
– Kashif
May 3 at 14:12
|
show 1 more comment
1 Answer
1
active
oldest
votes
in my extension i've created file etc/extension_attributes.xml with content
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoSalesApiDataOrderItemInterface">
<attribute code="voc_price" type="string"/>
</extension_attributes>
</config>
create plugin
<type name="MagentoSalesApiOrderRepositoryInterface">
<plugin name="custom_attributes_voc_discount" type="VendorExtensionPluginOrderGet"/>
</type>
OrderGet.php
<?php
namespace VendorExtensionPlugin;
use MagentoCatalogModelProductFactory;
class OrderGet
/** @var MagentoSalesApiDataOrderExtensionFactory */
protected $orderExtensionFactory;
/** @var MagentoSalesApiDataOrderItemExtensionFactory */
protected $orderItemExtensionFactory;
public function __construct(
MagentoSalesApiDataOrderExtensionFactory $orderExtensionFactory,
MagentoSalesApiDataOrderItemExtensionFactory $orderItemExtensionFactory
)
$this->orderExtensionFactory = $orderExtensionFactory;
$this->orderItemExtensionFactory = $orderItemExtensionFactory;
public function afterGet(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesApiDataOrderInterface $resultOrder
)
$resultOrder = $this->getExtensionAttributesItem($resultOrder);
return $resultOrder;
protected function getExtensionAttributesItem(MagentoSalesApiDataOrderInterface $order)
$orderItems = $order->getItems();
if (null !== $orderItems)
/** @var MagentoSalesApiDataOrderItemInterface $orderItem */
foreach ($orderItems as $orderItem)
$extensionAttributes = $orderItem->getExtensionAttributes();
if ($extensionAttributes && $extensionAttributes->getVocPrice())
continue;
$vocPrice = '5';
/** @var MagentoSalesApiDataOrderItemExtension $orderItemExtension */
$orderItemExtension = $extensionAttributes
? $extensionAttributes
: $this->orderItemExtensionFactory->create();
if($vocPrice)
$orderItemExtension->setVocPrice($vocPrice);
$orderItem->setExtensionAttributes($orderItemExtension);
return $order;
public function afterGetList(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesModelResourceModelOrderCollection $resultOrder
)
foreach ($resultOrder->getItems() as $order)
$this->afterGet($subject, $order);
return $resultOrder;
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f208670%2fadd-product-custom-options-in-rest-v1-orders%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
in my extension i've created file etc/extension_attributes.xml with content
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoSalesApiDataOrderItemInterface">
<attribute code="voc_price" type="string"/>
</extension_attributes>
</config>
create plugin
<type name="MagentoSalesApiOrderRepositoryInterface">
<plugin name="custom_attributes_voc_discount" type="VendorExtensionPluginOrderGet"/>
</type>
OrderGet.php
<?php
namespace VendorExtensionPlugin;
use MagentoCatalogModelProductFactory;
class OrderGet
/** @var MagentoSalesApiDataOrderExtensionFactory */
protected $orderExtensionFactory;
/** @var MagentoSalesApiDataOrderItemExtensionFactory */
protected $orderItemExtensionFactory;
public function __construct(
MagentoSalesApiDataOrderExtensionFactory $orderExtensionFactory,
MagentoSalesApiDataOrderItemExtensionFactory $orderItemExtensionFactory
)
$this->orderExtensionFactory = $orderExtensionFactory;
$this->orderItemExtensionFactory = $orderItemExtensionFactory;
public function afterGet(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesApiDataOrderInterface $resultOrder
)
$resultOrder = $this->getExtensionAttributesItem($resultOrder);
return $resultOrder;
protected function getExtensionAttributesItem(MagentoSalesApiDataOrderInterface $order)
$orderItems = $order->getItems();
if (null !== $orderItems)
/** @var MagentoSalesApiDataOrderItemInterface $orderItem */
foreach ($orderItems as $orderItem)
$extensionAttributes = $orderItem->getExtensionAttributes();
if ($extensionAttributes && $extensionAttributes->getVocPrice())
continue;
$vocPrice = '5';
/** @var MagentoSalesApiDataOrderItemExtension $orderItemExtension */
$orderItemExtension = $extensionAttributes
? $extensionAttributes
: $this->orderItemExtensionFactory->create();
if($vocPrice)
$orderItemExtension->setVocPrice($vocPrice);
$orderItem->setExtensionAttributes($orderItemExtension);
return $order;
public function afterGetList(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesModelResourceModelOrderCollection $resultOrder
)
foreach ($resultOrder->getItems() as $order)
$this->afterGet($subject, $order);
return $resultOrder;
add a comment |
in my extension i've created file etc/extension_attributes.xml with content
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoSalesApiDataOrderItemInterface">
<attribute code="voc_price" type="string"/>
</extension_attributes>
</config>
create plugin
<type name="MagentoSalesApiOrderRepositoryInterface">
<plugin name="custom_attributes_voc_discount" type="VendorExtensionPluginOrderGet"/>
</type>
OrderGet.php
<?php
namespace VendorExtensionPlugin;
use MagentoCatalogModelProductFactory;
class OrderGet
/** @var MagentoSalesApiDataOrderExtensionFactory */
protected $orderExtensionFactory;
/** @var MagentoSalesApiDataOrderItemExtensionFactory */
protected $orderItemExtensionFactory;
public function __construct(
MagentoSalesApiDataOrderExtensionFactory $orderExtensionFactory,
MagentoSalesApiDataOrderItemExtensionFactory $orderItemExtensionFactory
)
$this->orderExtensionFactory = $orderExtensionFactory;
$this->orderItemExtensionFactory = $orderItemExtensionFactory;
public function afterGet(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesApiDataOrderInterface $resultOrder
)
$resultOrder = $this->getExtensionAttributesItem($resultOrder);
return $resultOrder;
protected function getExtensionAttributesItem(MagentoSalesApiDataOrderInterface $order)
$orderItems = $order->getItems();
if (null !== $orderItems)
/** @var MagentoSalesApiDataOrderItemInterface $orderItem */
foreach ($orderItems as $orderItem)
$extensionAttributes = $orderItem->getExtensionAttributes();
if ($extensionAttributes && $extensionAttributes->getVocPrice())
continue;
$vocPrice = '5';
/** @var MagentoSalesApiDataOrderItemExtension $orderItemExtension */
$orderItemExtension = $extensionAttributes
? $extensionAttributes
: $this->orderItemExtensionFactory->create();
if($vocPrice)
$orderItemExtension->setVocPrice($vocPrice);
$orderItem->setExtensionAttributes($orderItemExtension);
return $order;
public function afterGetList(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesModelResourceModelOrderCollection $resultOrder
)
foreach ($resultOrder->getItems() as $order)
$this->afterGet($subject, $order);
return $resultOrder;
add a comment |
in my extension i've created file etc/extension_attributes.xml with content
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoSalesApiDataOrderItemInterface">
<attribute code="voc_price" type="string"/>
</extension_attributes>
</config>
create plugin
<type name="MagentoSalesApiOrderRepositoryInterface">
<plugin name="custom_attributes_voc_discount" type="VendorExtensionPluginOrderGet"/>
</type>
OrderGet.php
<?php
namespace VendorExtensionPlugin;
use MagentoCatalogModelProductFactory;
class OrderGet
/** @var MagentoSalesApiDataOrderExtensionFactory */
protected $orderExtensionFactory;
/** @var MagentoSalesApiDataOrderItemExtensionFactory */
protected $orderItemExtensionFactory;
public function __construct(
MagentoSalesApiDataOrderExtensionFactory $orderExtensionFactory,
MagentoSalesApiDataOrderItemExtensionFactory $orderItemExtensionFactory
)
$this->orderExtensionFactory = $orderExtensionFactory;
$this->orderItemExtensionFactory = $orderItemExtensionFactory;
public function afterGet(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesApiDataOrderInterface $resultOrder
)
$resultOrder = $this->getExtensionAttributesItem($resultOrder);
return $resultOrder;
protected function getExtensionAttributesItem(MagentoSalesApiDataOrderInterface $order)
$orderItems = $order->getItems();
if (null !== $orderItems)
/** @var MagentoSalesApiDataOrderItemInterface $orderItem */
foreach ($orderItems as $orderItem)
$extensionAttributes = $orderItem->getExtensionAttributes();
if ($extensionAttributes && $extensionAttributes->getVocPrice())
continue;
$vocPrice = '5';
/** @var MagentoSalesApiDataOrderItemExtension $orderItemExtension */
$orderItemExtension = $extensionAttributes
? $extensionAttributes
: $this->orderItemExtensionFactory->create();
if($vocPrice)
$orderItemExtension->setVocPrice($vocPrice);
$orderItem->setExtensionAttributes($orderItemExtension);
return $order;
public function afterGetList(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesModelResourceModelOrderCollection $resultOrder
)
foreach ($resultOrder->getItems() as $order)
$this->afterGet($subject, $order);
return $resultOrder;
in my extension i've created file etc/extension_attributes.xml with content
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="MagentoSalesApiDataOrderItemInterface">
<attribute code="voc_price" type="string"/>
</extension_attributes>
</config>
create plugin
<type name="MagentoSalesApiOrderRepositoryInterface">
<plugin name="custom_attributes_voc_discount" type="VendorExtensionPluginOrderGet"/>
</type>
OrderGet.php
<?php
namespace VendorExtensionPlugin;
use MagentoCatalogModelProductFactory;
class OrderGet
/** @var MagentoSalesApiDataOrderExtensionFactory */
protected $orderExtensionFactory;
/** @var MagentoSalesApiDataOrderItemExtensionFactory */
protected $orderItemExtensionFactory;
public function __construct(
MagentoSalesApiDataOrderExtensionFactory $orderExtensionFactory,
MagentoSalesApiDataOrderItemExtensionFactory $orderItemExtensionFactory
)
$this->orderExtensionFactory = $orderExtensionFactory;
$this->orderItemExtensionFactory = $orderItemExtensionFactory;
public function afterGet(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesApiDataOrderInterface $resultOrder
)
$resultOrder = $this->getExtensionAttributesItem($resultOrder);
return $resultOrder;
protected function getExtensionAttributesItem(MagentoSalesApiDataOrderInterface $order)
$orderItems = $order->getItems();
if (null !== $orderItems)
/** @var MagentoSalesApiDataOrderItemInterface $orderItem */
foreach ($orderItems as $orderItem)
$extensionAttributes = $orderItem->getExtensionAttributes();
if ($extensionAttributes && $extensionAttributes->getVocPrice())
continue;
$vocPrice = '5';
/** @var MagentoSalesApiDataOrderItemExtension $orderItemExtension */
$orderItemExtension = $extensionAttributes
? $extensionAttributes
: $this->orderItemExtensionFactory->create();
if($vocPrice)
$orderItemExtension->setVocPrice($vocPrice);
$orderItem->setExtensionAttributes($orderItemExtension);
return $order;
public function afterGetList(
MagentoSalesApiOrderRepositoryInterface $subject,
MagentoSalesModelResourceModelOrderCollection $resultOrder
)
foreach ($resultOrder->getItems() as $order)
$this->afterGet($subject, $order);
return $resultOrder;
answered Sep 25 '18 at 13:45
omelandromelandr
6071822
6071822
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f208670%2fadd-product-custom-options-in-rest-v1-orders%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you find a solution?
– Alex
Sep 24 '18 at 8:33
@Alex yes i found
– omelandr
Sep 25 '18 at 9:03
like this ? magento.stackexchange.com/questions/243442/… @omelandr
– Alex
Sep 25 '18 at 10:15
1
@Alex yes, extenison attributes see my answer
– omelandr
Sep 25 '18 at 13:35
@omelandr this does not work for me .....
– Kashif
May 3 at 14:12