New answers tagged

0

To Authenticate the customer we have to only add /** @var ContextInterface $context */ if (false === $context->getExtensionAttributes()->getIsCustomer()) { throw new GraphQlAuthorizationException(__('The current customer isn\'t authorized.')); } this before any API so it will check that whether Customer is Authorized or not....


0

Add to cart button in product page coming from Catalog module with product/view/addtocart.phtml template file. If you want to customization on addtocart template file in Magento 2, You can override addtocart.phtml file in your module by this way. Create the catalog_product_view.xml file in your module on following place. app\code\Vendor\Extension\view\...


0

Magento stores dates/times in the database as UTC. "CEST" is Central European Summer Time which is UTC+2 so it looks like the times are correct. What you need to do with the API response is localise it to the desired timezone. Hope that helps.


0

Assuming you want the Magento store to handle the entire order process and not just the fulfilment then the easiest way would be to use the REST API (or if the Magento instance is on a more recent version there is also the GraphQL API). I would recommend you start by reading the REST API Reference here https://devdocs.magento.com/guides/v2.4/rest/tutorials/...


0

Graphql Support available now. List: https://devdocs.magento.com/guides/v2.4/graphql/queries/customer.html Create: https://devdocs.magento.com/guides/v2.4/graphql/mutations/create-wishlist.html Add products to wishlist: https://devdocs.magento.com/guides/v2.4/graphql/mutations/add-products-to-wishlist.html Add wishlist items to cart: https://devdocs.magento....


0

Have a look here magento 2 : How to use curl? and Magento 2 REST API usage with examples for more details read this devdoc https://devdocs.magento.com/guides/v2.4/get-started/gs-curl.html


0

You need to use this code. /*Dynamically generating rows & columns*/ foreach($data["items"] as $productdata) { $temp .= "<tr>"; $temp .= "<td>" . $productdata["sku"] . "</td>"; $temp .= "<td>" . $productdata["name"] . "</td>"; $...


0

Guest cart quote ids (cart ids) are masked for security reasons. So it returns encoded quote id. That is correct way. You should use that masked quote id. Since it is guest cart, you should send that masked quote id in other requests, and magento will decode it and will use it. For example look here how guest cart items are managed vendor/magento/module-...


0

You can try $url = " "; //url External API $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); // or POST curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " .$...


0

You can get current cart Id using this code. public function __construct( \Magento\Checkout\Model\Cart $cart, ) { $this->_cart = $cart; } public function MyCustomFunction(){ return $this->_cart->getQuote()->getId(); }


0

public function beforeSave(OrderRepositoryInterface $subject, OrderInterface $order) { $extensionAttributes = $order->getExtensionAttributes(); $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create(); $resultOrder->setData(self::CUSTOM_SALES_ID, $extensionAttributes->getCustomSalesId())...


1

I have been there so i used this approach and this works for me try to create XML in variable like this foreach ($orderItems as $_item) { $orderItemstring = '<orderItem> <name>' . $_item->getName() . '</name> <barcode>' . $_item->getSku() . '</barcode> <externalId>' . $...


Top 50 recent answers are included