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
0 answers
14 views

Magento 2 : import product into grid

Here is import button, When i click import button, add this sku product (test-sku) into item ordered grid Drop your answer or suggestion.
user avatar
1 vote
1 answer
28 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 ...
user avatar
0 votes
2 answers
85 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 ...
user avatar
  • 1,838
0 votes
0 answers
81 views

Magento 2 $quote->getAllItems(); set StoreId or Website

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->...
user avatar
0 votes
0 answers
13 views

Magento 2 Tax Rate displayed on invoice with 4 decimals

How can I display the tax rate rounded with no decimals on the invoices? Right now It is displayed with 4 decimals, like you can see it on the picture I attached. Thank you! Best Regards Simon
user avatar
0 votes
2 answers
88 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 ...
user avatar
1 vote
2 answers
51 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.
user avatar
0 votes
1 answer
22 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?
user avatar
0 votes
1 answer
41 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 ...
user avatar
0 votes
0 answers
30 views

Magento 2: How to get Get recently viewed product collection by customer id?

I'm trying to fetch all the products by customer-id for the recently viewed items, but the database table 'report_viewed_product_index' is empty but the recently viewed product is visible on the ...
user avatar
  • 60
0 votes
1 answer
51 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 ...
user avatar
  • 60
0 votes
0 answers
28 views

Old categories are not removed from product when using setCategoryIds

I am updating product details programmatically. I want to replace category IDs in product. But using setCategoryIds , it only appends new category IDs in product but not removing old categories. How i ...
user avatar
  • 1,958
0 votes
2 answers
28 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 ...
user avatar
0 votes
0 answers
48 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 ...
user avatar
1 vote
1 answer
185 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-...
user avatar
  • 109
0 votes
1 answer
82 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\...
user avatar
  • 1,484
0 votes
1 answer
128 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',...
user avatar
0 votes
1 answer
194 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\...
user avatar
0 votes
3 answers
733 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 ...
user avatar
0 votes
0 answers
160 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\...
user avatar
  • 95
0 votes
0 answers
180 views

How to add cms static block to category description programmatically

Instead of directly add cms block to category description, how to add programmatically?
user avatar
  • 95
0 votes
0 answers
136 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 ...
user avatar
0 votes
1 answer
68 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 ...
user avatar
0 votes
1 answer
103 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($...
user avatar
0 votes
1 answer
225 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 ...
user avatar
  • 526
0 votes
1 answer
204 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 ...
user avatar
0 votes
1 answer
498 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) { ...
user avatar
2 votes
4 answers
1k 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 ...
user avatar
0 votes
2 answers
448 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 ...
user avatar
  • 133
1 vote
0 answers
14 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 '...
user avatar
1 vote
2 answers
187 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 ...
user avatar
  • 31
1 vote
1 answer
504 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.
user avatar
1 vote
2 answers
247 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 ...
user avatar
  • 526
0 votes
1 answer
94 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 ...
user avatar
0 votes
1 answer
24 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\...
user avatar
  • 15
0 votes
0 answers
79 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 ...
user avatar
  • 1,442
1 vote
0 answers
174 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 ...
user avatar
  • 11
0 votes
1 answer
395 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 ?
user avatar
  • 125
1 vote
0 answers
20 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 ...
user avatar
1 vote
2 answers
237 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/...
user avatar
0 votes
0 answers
218 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 ?
user avatar
  • 1,367
0 votes
0 answers
717 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 ...
user avatar
  • 1
0 votes
1 answer
68 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.
user avatar
0 votes
1 answer
348 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-&...
user avatar
  • 1,028
0 votes
1 answer
12 views

how to het customer pick date for electron product, example, amusement park ticket

I'm trying to sell tickets electronically. Consider like an amusement park, or parking lot tickets. No worries about assigned seats or limited dates / times. I can handle checking if it is sold out, ...
user avatar
  • 131
0 votes
1 answer
291 views

Magento2: How to disabled coupon code programmatically from the cart and checkout page?

I want to disabled coupon code programmatically from the cart and checkout page if the condition is true. Please help me.
user avatar
  • 1,127
1 vote
1 answer
451 views

setData does not set attributes values

I am creating simple products and try to set some attribute values $attributeSetId = $product->getDefaultAttributeSetId(); $product->setSku($sku); // Set your sku here $product->setName($...
user avatar
0 votes
0 answers
51 views

How to assign simple product to configurable product programatically in magento 2?

I want to know any script where we can assign a simple product to configurable products with just add product Id. can anyone give me script for it?
user avatar
1 vote
0 answers
35 views

Magento 2.3: Order Create Programatically Script Allowed memory exhausted

I am working on creating orders dynamically using custom magento script , got reference from How to create order programmatically in Magento 2? now when I run script, after making 10-15 orders, first ...
user avatar
  • 1,478
1 vote
3 answers
2k views

How to pass the value and call js function from template.html using knockout js in(in checkout page) Magento 2?

I have to call and pass value to the js function(showPopup())from the template(when clicking the Verify OTP button). How to achieve this?. But now i am not able to call the js function. layout file &...
user avatar
  • 309

1
2 3 4 5
8