Questions tagged [programmatically]

Denotes questions related to making changes to the Magento platform programmatically, rather than via the admin interface.

Filter by
Sorted by
Tagged with
0 votes
2 answers
64 views

magento creating order programmatically using Cron Jobs

I want to create an order programmatically using Cron jobs, the codes run perfectly but when creating the order i got 'Error: Type Error occurred when creating object: Magento\InventoryIndexer\Model\...
Adex's user avatar
  • 25
0 votes
0 answers
19 views

Place order programmatically with Stripe as apayment method

I want to create order programmatically,where stripe will be the payment method.once the codes will trigger,need to redirect customer to stripe checkout to fill card details
Vishal kumar singh's user avatar
0 votes
0 answers
63 views

Magento 2: Create order programmatically using carrier containing underscore (PostNL)

I am unable to create an order programmatically with the carrier PostNL. The carrier code is "tig_postnl" and the method "regular". Normally I set the shipping address simply using:...
Tober's user avatar
  • 23
2 votes
2 answers
222 views

How to get email template content using template id in magento 2?

I need to get email template content like text/html using template id/code programmatically any help/suggestion much appreciated. Thanks in advance.
Chandresh Chauhan's user avatar
1 vote
1 answer
39 views

Get product's related products based on rule

I am trying to get the related products from a specific product using the function getRelatedProducts. $relatedProductsArray = $productModel->getRelatedProducts(); if($relatedProductsArray &&...
Eliacim DAVILA - CENSERE's user avatar
1 vote
2 answers
212 views

How to create duplicate product programmatically in magento2.4.6?

I want to create a duplicate product using the product id programmatically. I have tried many solutions but have not had success. How to do it?
Keval Chauhan's user avatar
0 votes
1 answer
94 views

Update price progrmmatically

I'm trying to update the price for configurable product programmatically. But the price is not updating. Also I'm getting integrity constrain error when the sku is not assigned. if($proType == '...
Sandeep Nair's user avatar
1 vote
1 answer
24 views

Can a widget extend a class besdides Template?

All widgets I have ever created programmatically extends Template implements BlockInterface and I was curious if you can extend different classes for a widget module's block?
A. Andersen's user avatar
2 votes
0 answers
65 views

Error in Shipment Email in magento 2 when creating programmatically

I created the shipment programmatically. Shipment is created and email is not sending. I am getting the following error. I followed RAKESH JESADIYA's this tutorial for this task. main.CRITICAL: Error:...
Mujahidh's user avatar
  • 2,791
4 votes
2 answers
8k views

How to update product salable quantity in Magento 2.4 programmatically?

I am trying to import products programmatically into a Magento 2.4.4 installation but I have problem setting the Salable Quantity. I cannot find a viable solution to this issue, please help if you can....
jfeid's user avatar
  • 43
1 vote
1 answer
85 views

Custom attribute created programmatically not working properly - Magento 1.9

I'm developing a module that creates configurable products, it's simple products and the attributes used to create this configurable (if not exists). All seems fine, products are created, associated ...
Matheus Delazeri's user avatar
0 votes
2 answers
1k views

Magento 2 : How to calculate discount and shipping charges to programmatically created order?

I'm creating an order programmatically. I have added cart price rule in backend for subtotal above 1000 will get 30% product price discount on product When generating order(programmatically) as a ...
Mohit Rane's user avatar
  • 1,945
2 votes
0 answers
294 views

Magento 2 update quote StoreId ($quote->setStoreId()) or Store ($quote->setStore()) not working

Try to catch the quote items, it's working fine. But when quote is not in default website, the request is empty. How to change website ID or store ID in quote request? Did try with: $quote->...
user2270134's user avatar
0 votes
2 answers
433 views

Magento 2 How to create back order programmatically

I have created order programatically for my some of the store products and it's created successfully. but my some products are 0 qty than also i want to create order for that 0 qty products. can ...
Sanjay Shiyal's user avatar
1 vote
2 answers
579 views

How to Get Order Details in Magento 2?

Want to get the order details programmatically, need to use an object manager. But unfortunately, Magento 2 restricts the direct use of the ObjectManager.
Kuldeep Sharma's user avatar
0 votes
1 answer
29 views

How to check if tablerate is active in custom shipping method?

I have custom shipping method but I would like to return false when tablerates is appear in Checkout page. Anyway to check the condition?
Mack Sookjai's user avatar
0 votes
1 answer
241 views

How to Programatically cancel order in magento 2

If a customer placed an order of 3 different items with different quantities like shirt 2 qty Watch 1qty pant 3qty and cancels the order item at different times I have to set the state to order ...
Aniket Singh's user avatar
0 votes
1 answer
152 views

Magento 2: How to add different watermark based on Vendor?

I have a multi-vendor setup on my site and based on per vendor products, I want to apply a watermark. By default, Magento applies watermarks on all the products based on the website/ store. Can anyone ...
Bushra's user avatar
  • 62
0 votes
2 answers
721 views

How to get all products with attribute data in custom created class

I'm pretty new to Magento, and I are trying to create a module for it, but I'm a little stock now because I'm trying to get all products out there are created in the store there are enabled. I'm ...
ParisNakitaKejser's user avatar
0 votes
0 answers
107 views

Magento 2: Set cron schedule dynamically from frontend

I want to set schedule of cron job from values chosen by the customer from the frontend. I have created checkboxes on checkout page through which I want to set the schedule of email reminders chosen ...
mechanic's user avatar
  • 440
1 vote
1 answer
858 views

How to refund only part of an order programmatically

I am looking for a way to programmatically refund part of an order within a custom module. I have been following this blog post (https://www.rakeshjesadiya.com/create-creditmemo-for-order-item-in-...
SNAFU's user avatar
  • 176
0 votes
1 answer
500 views

How to apply cart rules directly on Order?

I have added a BIN promotion which is needed to be applied just before payment directly on order. I have found 2 methods that apply discount but require a quote object. \Magento\SalesRule\Model\...
Milind Singh's user avatar
  • 1,584
0 votes
1 answer
399 views

How to create ui-select in form programmatically

My code to generate the field multi-select $fieldset->addField('multiselect2', 'multiselect', array( 'label' => __('Select Type2'), 'class' => 'required-entry',...
MeChris99's user avatar
0 votes
1 answer
2k views

magento 2: how to checked use default value for product status programmtically?

I have to update and checked checkbox for use default field for product status. But I do not know how to update and checked that checkbox ? here is my code $objectManager = \Magento\Framework\App\...
Niraj Patel's user avatar
0 votes
3 answers
2k views

Magento 2 Place Order Programmatically Using Event Observer

Created a custom form where customer and product details filled with status of Active/Not active So for now I want to create an event and observer to place order programmatically when status is Active ...
Arun Sharma's user avatar
  • 1,305
0 votes
0 answers
288 views

Magento 2 - Using observer how to Set CMS block to category description block programmatically

Using observer how to set catalog categories content Add CMS Block (category.description) programmatically My observer: <?php namespace Zero\DescBlock\Observer; use Magento\Framework\Event\...
zus's user avatar
  • 155
0 votes
0 answers
310 views

How to add cms static block to category description programmatically

Instead of directly add cms block to category description, how to add programmatically?
zus's user avatar
  • 155
0 votes
0 answers
587 views

Magento 2: Error while create category programmtically: Call to undefined method Magento\Catalog\Model\ResourceModel\Category\Flat::getEntityTable()

I am creating a category programmatically in magento 2 in controller, but I am getting error Call to undefined method Magento\Catalog\Model\ResourceModel\Category\Flat::getEntityTable() I have also ...
Niraj Patel's user avatar
0 votes
1 answer
139 views

Set Product Custom Options From Observer Magento 1.9

I am trying to add custom options to products on save. I want to add or update custom options (not additional options) on before_product save. I am able to access the observer and it is working on ...
Charanjeet Singh's user avatar
0 votes
1 answer
324 views

How to delete a product's category Magento2

I am trying to delete a product's category in magento 2 using the following code. public function deleteCategories($product_id){ $categoryIds = $this->productCategory->getCategoryIds($...
vartika sharma's user avatar
0 votes
1 answer
648 views

How to add field value while creating a simple product Programmatically in Magento 2?

I have successfully created simple product Programmatically using magento 2. But i have created a filed in back end and add that in product but how to fill that data when creating a product. I have ...
Prits's user avatar
  • 626
0 votes
1 answer
520 views

Products are not updating programmatically Magento2

I'm trying to update product details by this code - public function updateProducts(){ $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // instance of object manager ...
vartika sharma's user avatar
0 votes
1 answer
1k views

Magento 2: What's the difference between Store and Group?

I want to create a Store programatically, but if it already exists, then return the existing store. So far my code looks like this: private function _getStore($website, $storeName, $storeCode) { ...
Paloma Martinez's user avatar
2 votes
4 answers
2k views

faster way to update attributes/ update product programmtically with stock data in Magento 2?

I have this code but Anybody tell me faster way to update products. This below code takes much time. So any alternative solution for to save product in fast way and Can I also put sleep function at ...
Niraj Patel's user avatar
0 votes
2 answers
1k views

Add products to cart using \Magento\Quote\Api\CartRepositoryInterface

I'm trying to add products to cart programmatically using \Magento\Quote\Api\CartRepositoryInterface since \Magento\Checkout\Model\Cart is already deprecated. My code is successfully being inserted in ...
mendz's user avatar
  • 143
1 vote
0 answers
18 views

magento 2: value not saved for attribute by programmatically

I am trying to save some values in my attribute by programmatically. My attribute name is storage. type is dropdown I am trying to save values like 32GB or 16GB this values do not saved but if I used '...
Niraj Patel's user avatar
1 vote
2 answers
753 views

Can't get order with OrderRepositoryInterface

I have an order in sales_order with entity_id = 1 and increment_id = 000000001. Both ways of trying to get this order fails with the same response. $searchCriteria = $this->searchCriteriaBuilder ...
BiciAP's user avatar
  • 41
1 vote
1 answer
840 views

Unlink simple product variant from configurable product programmatically in magento 2

I want to unlink some (not all) simple products from configurable product. I don't want to delete simple products, I just want to unlink from the main configurable product programmatically.
Ghulam Akbar's user avatar
1 vote
1 answer
593 views

Magento 2 - How Can I Send Success and Error in JSON and from Frontend update product price and enable/'disable?

Ajax runs on page load i want to run it on button click. I create one Module and make a custom tab which is display some product with name and price and if the product is enable/disable. I want that ...
Prits's user avatar
  • 626
0 votes
1 answer
284 views

How to make cache for specific url by programmatically?

I need suggestion. I do not have an Idea to set cache for specific page url. For example I have an Url : http://127.0.0.1/magento234/women/tops-women/jackets-women.html How can I set full page cache ...
Niraj Patel's user avatar
0 votes
1 answer
126 views

Problem in retrieving orders with "processing" status

I am using the code below to filter orders by their status and after to change it to complete use Psr\Log\LoggerInterface; class OrderStatus { /** * @var \Magento\Sales\Api\...
iomack's user avatar
  • 15
0 votes
0 answers
105 views

Magento 2 + Programatically create product issue

<?php declare(strict_types=1); namespace Test\Xyz\Model\SampleData; use Exception; use Magento\Catalog\Api\Data\ProductInterfaceFactory; use Magento\Catalog\Api\ProductRepositoryInterface; use ...
Yogesh's user avatar
  • 1,503
1 vote
1 answer
346 views

Bundle_option_qty not working, with programmatically add bundle product to cart (magento 2.3.2)

I would like to add a bundle product to cart programmatically, however i'm experiencing a problem with the bundle_option_qty. I can change the selection of the bundle option, however the code is ...
WvA's user avatar
  • 11
0 votes
1 answer
1k views

Magento 2.3: Re-save all products programatically [closed]

I need to re-save all products programatically without modifying any attribute. (Only re-save) How to do that ?
Kiwop's user avatar
  • 145
1 vote
0 answers
22 views

Store wih diferent languages have broken images after programmatically product import

I have a script running in cron to import products. This import creates simple products and then creates a configurable one with all these simple ones as children of that. During this process, I ...
Matheus Prado's user avatar
1 vote
3 answers
789 views

How to display programmatically created custom options in admin order details

I created 4 programmatically custom options. It is successfully display in cart page and also make successful order. I created module for that. Here its code. path : vendor/addtocart/controller/index/...
Chirag Parmar's user avatar
0 votes
0 answers
336 views

Can we Create Product Attributes Programmatically without using setup Script in magento 2.3?

Can you help to Create Product Attributes Programmatically without using setup Script in magento 2.3 ?
shankar boss's user avatar
  • 1,453
0 votes
0 answers
1k views

Importing Date Attributes in DD/MM/YYYY format

When importing products with date fields in format dd/mm/YYYY it throws this error: Value for 'special_to_date' attribute contains incorrect value in row(s): 1, 2, 3 From reading around I see ...
Johnny's user avatar
  • 1
0 votes
1 answer
145 views

What is difference between creating custom attribute programmatically and via admin in magento 2?

Creating an attribute in the back end is easy, then why to create it as programmatically? I like to know what is the difference between these two.
Kowsigan Atsayam's user avatar
0 votes
1 answer
791 views

Magento 2 : add tier price programatically for all customer Group

How to add Tier Price programatically for all customer group Tried below not working. As ALL GROUP id is 32000; $sku = "test"; $customerGroupId = 32000; $price = 5.5; $qty = 2; $tierPrice = $obj-&...
Tirth Patel's user avatar
  • 1,039

1
2 3 4 5
8