magento2 – Change “Manage_Stock” via REST API on Magento 2

Using Magento 2, I’m trying to change Manage Stock attribute via rest API however does not seem to work via both the stockItems endpoint or the product one. Updating quantity seems to work fine.

Tried like below initially:

    $url = "https://www.magestore.com/rest/all/V1/products/" . $sku;
    $post_data = array(
        'product' =>
        array(
            'sku' => $sku,
            'extension_attributes' => 
                array(
                    "stock_item" => array( 
                        "qty" => $qty,
                        "is_in_stock" => $is_in_stock,
                        "manage_stock" => true
                    )
                )
            )
        );

Then tried like this for the stockItems endpoint:

    $url = "https://www.magestores.com/rest/V1/products/" . $sku . "/stockItems/1";
    $post_data = array(
        "stock_item" => array( 
                "qty" => $qty,
                "is_in_stock" => $is_in_stock,
                "manage_stock" => true
            )
        );

However neither seem to change manage stock to true for me, is this possible to achieve with Rest API?

magento2 – How to modifiy order response Rest API magento 2

How i can modify order response only needed fields

Request url

http://localhost/magento2/index.php/rest/V1/orders?searchCriteria[currentPage]=1&searchCriteria[pageSize]=1

Reponse:

{
    "items": [
        {
            "adjustment_negative": 0,
            "adjustment_positive": 0,
            "base_adjustment_negative": 0,
            "base_adjustment_positive": 0,
            "base_currency_code": "USD",
            "base_discount_amount": 0,
            "base_discount_invoiced": 0,
            "base_discount_refunded": 0,
            "base_grand_total": 78.61,
            "base_discount_tax_compensation_amount": 0,
            "base_discount_tax_compensation_invoiced": 0,
            "base_discount_tax_compensation_refunded": 0,
            "base_shipping_amount": 5,
            "base_shipping_discount_amount": 0,
            "base_shipping_discount_tax_compensation_amnt": 0,
            "base_shipping_incl_tax": 5,
            "base_shipping_invoiced": 5,
            "base_shipping_refunded": 5,
            "base_shipping_tax_amount": 0,
            "base_shipping_tax_refunded": 0,
            "base_subtotal": 68,
            "base_subtotal_incl_tax": 73.61,
            "base_subtotal_invoiced": 68,
            "base_subtotal_refunded": 68,
            "base_tax_amount": 5.61,
            "base_tax_invoiced": 5.61,
            "base_tax_refunded": 5.61,
            "base_total_due": 0,
            "base_total_invoiced": 78.61,
            "base_total_invoiced_cost": 0,
            "base_total_offline_refunded": 78.61,
            "base_total_paid": 78.61,
            "base_total_refunded": 78.61,
            "base_to_global_rate": 1,
            "base_to_order_rate": 1,
            "billing_address_id": 2,
            "created_at": "2020-02-04 07:26:46",
            "customer_dob": "1973-12-15 00:00:00",
            "customer_email": "roni_cost@example.com",
            "customer_firstname": "Veronica",
            "customer_gender": 2,
            "customer_group_id": 1,
            "customer_id": 1,
            "customer_is_guest": 0,
            "customer_lastname": "Costello",
            "customer_note_notify": 1,
            "discount_amount": 0,
            "discount_invoiced": 0,
            "discount_refunded": 0,
            "entity_id": 1,
            "global_currency_code": "USD",
            "grand_total": 78.61,
            "discount_tax_compensation_amount": 0,
            "discount_tax_compensation_invoiced": 0,
            "discount_tax_compensation_refunded": 0,
            "increment_id": "000000001",
            "is_virtual": 0,
            "order_currency_code": "USD",
            "protect_code": "c5830155c66b416658dada71ad825ede",
            "quote_id": 1,
            "shipping_amount": 5,
            "shipping_description": "Flat Rate - Fixed",
            "shipping_discount_amount": 0,
            "shipping_discount_tax_compensation_amount": 0,
            "shipping_incl_tax": 5,
            "shipping_invoiced": 5,
            "shipping_refunded": 5,
            "shipping_tax_amount": 0,
            "shipping_tax_refunded": 0,
            "state": "closed",
            "status": "closed",
            "store_currency_code": "USD",
            "store_id": 1,
            "store_name": "Main WebsitenMain Website StorenDefault Store View",
            "store_to_base_rate": 0,
            "store_to_order_rate": 0,
            "subtotal": 68,
            "subtotal_incl_tax": 73.61,
            "subtotal_invoiced": 68,
            "subtotal_refunded": 68,
            "tax_amount": 5.61,
            "tax_invoiced": 5.61,
            "tax_refunded": 5.61,
            "total_due": 0,
            "total_invoiced": 78.61,
            "total_item_count": 1,
            "total_offline_refunded": 78.61,
            "total_paid": 78.61,
            "total_qty_ordered": 1,
            "total_refunded": 78.61,
            "updated_at": "2020-02-04 07:26:52",
            "weight": 1,
            "items": [
                {
                    "amount_refunded": 68,
                    "base_amount_refunded": 68,
                    "base_discount_amount": 0,
                    "base_discount_invoiced": 0,
                    "base_discount_refunded": 0,
                    "base_discount_tax_compensation_amount": 0,
                    "base_discount_tax_compensation_invoiced": 0,
                    "base_discount_tax_compensation_refunded": 0,
                    "base_original_price": 68,
                    "base_price": 68,
                    "base_price_incl_tax": 73.61,
                    "base_row_invoiced": 68,
                    "base_row_total": 68,
                    "base_row_total_incl_tax": 73.61,
                    "base_tax_amount": 5.61,
                    "base_tax_invoiced": 5.61,
                    "base_tax_refunded": 5.61,
                    "created_at": "2020-02-04 07:26:46",
                    "discount_amount": 0,
                    "discount_invoiced": 0,
                    "discount_percent": 0,
                    "discount_refunded": 0,
                    "free_shipping": 0,
                    "discount_tax_compensation_amount": 0,
                    "discount_tax_compensation_invoiced": 0,
                    "discount_tax_compensation_refunded": 0,
                    "is_qty_decimal": 0,
                    "item_id": 1,
                    "name": "Valeria Two-Layer Tank",
                    "no_discount": 0,

etcwebapi_restdi.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoSalesApiOrderRepositoryInterface">
        <plugin name="order_rest_api_response_change" type="CustomExtendedSalesPluginApiOrderRepository" />
    </type>
</config>

i wrote plugin but i how i can modify Response data to only needed
fields for me?

javascript – Is it possible to load data from the server using a HTTP POST request within a Magento Module js file?

Is it possible to load data from the server using an HTTP POST request within a Magento Module js file?

File located in
app/code/MyVendor/myCustomModule/view/frontend/web/js/mycustom.js

Example request:

   function test(){
      $.post("sample_data.php", function(data, status){
        alert("Data: " + data + "nStatus: " + status);
      });
    };

On the frontend I get 403 error when the sample_data.php is called

magento2 – How to stop Magento 2 using cookies like recently_viewed_product?

According to the GDPR and recent court decisions, technically unnecessary cookies may only be set after the user has given his active consent.

Cookies that are not technically necessary are widely regarded as cookies for tracking, marketing, external media, etc.

Magento 2 sets the following cookies, among others:

  • recently_viewed_product
  • recently_viewed_product_previous
  • recently_compared_product
  • recently_compared_product_previous

First question:
Does Magento use these cookies to recognize the preferences of the visitor during subsequent page views or sessions and to display products that suit the visitor? In my opinion, these would then be marketing cookies that should not be set until the user actively agrees?

Second question:
How can the above mentioned cookies be deactivated without affecting the basic functionality of Magento?

magento2 – Magento 2 API: Extension Attribute with null value not showing

I’m retrieving from the Magento API an order by its increment_id attribute like this:

http://mystore.com/rest/V1/orders?searchCriteria(filter_groups)(0)(filters)(0)(field)=increment_id&searchCriteria(filter_groups)(0)(filters)(0)(value)=1200040527&searchCriteria(filter_groups)(0)(filters)(0)(condition_type)=eq

I have added a plugin to add a custom attribute to the Order items like this (etc/di.xml):

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="MagentoSalesApiOrderRepositoryInterface">
        <plugin name="order_custom_extension_attribute"
                type="MyVendorSalesPluginOrderRepositoryPlugin"/>
    </type>
</config>

And then adding the custom attribute (is_gift_card) to the OrderItem like this (etc/extension_attributes.xml)

<?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="is_gift_card" type="boolean"/>
    </extension_attributes>
</config>

Finally my plugin to add the extension attribute to the order items in the afterGet and afterGetList:

    public function __construct(
         MagentoSalesApiDataOrderExtensionFactory $extensionFactory
    ) {
        $this->extensionFactory = $extensionFactory;
    }

    public function afterGet(MagentoSalesApiOrderRepositoryInterface $subject, MagentoSalesApiDataOrderInterface $order)
    {
        return $this->addExtensionAttributes($order);
    }

    public function afterGetList(MagentoSalesApiOrderRepositoryInterface $subject, MagentoSalesApiDataOrderSearchResultInterface $searchResult)
    {
        $orders = $searchResult->getItems();

        foreach ($orders as &$order) {
           $order = $this->addExtensionAttributes($order);
        }

        return $searchResult;
    }

    private function addExtensionAttributes($order){

        $items = $order->getAllItems();
        foreach ($items as $item){
            $giftCard = $item->getData('is_gift_card');
            
            $extensionAttributes = $item->getExtensionAttributes();
            $extensionAttributes = $extensionAttributes ? $extensionAttributes : $this->extensionFactory->create();
            $extensionAttributes->setIsGiftCard($giftCard);
            $item->setExtensionAttributes($extensionAttributes);
        }

        return $order;
    }
}

The thing is that is_gift_card is added to the extension_attribute segment IF that attribute has any value, but it is not showing at all if it has a null value.

Is this a normal behaviour from the Magento API?

Thanks in advanced

composer – Magento 2 replace dotmailer/dotmailer-magento2-extension errors with compiler error

We have added the following to composer json in M 2.3.5

    "replace": {
    "dotmailer/dotmailer-magento2-extension": "*",

Then we run php bin/magento setup:di:compile

And are presented with this error

Repositories code generation... 1/8 [===>------------------------]  12% 1 sec 88.5 MiB
PHP Fatal error:  Interface 'DotdigitalgroupEmailBlockAdminhtmlEngagementCloudEmbedInterface' 
not found in /var/www/html/m2/m2_dev/vendor/dotmailer/dotmailer-magento2-extension-chat/Block/Adminhtml/StudioChatWidget.php on line 13

Question: Is there more we need to do to disable Dotdigital?

World-Bases.com – the best domains list on various CMS: WordPress, Joomla, Magento, Drupal etc. – Websites & Domains

World-Bases – service for selling lists of sites/domains on a variety of CMS. In the presence of more than 40 CMS containing more than 1500 domain zones, here are just a few of them:

  • WordPress
  • Joomla
  • Magento
  • Drupal
  • OpenCart
  • All delegated domains
  • All alive sites (HTTP Response Code 200)
  • All online shops

Verification is carried out exclusively on fresh lists of all delegated domains received directly from registrars (gTLD, ccTLD, IDN, New gTLD), as well as lists of subdomains collected from private services and DNS records.
For verification, proprietary software is used. Databases are updated on a regular basis. The quality of the databases at the time of publication of the update is at least 95%.

How to check the quality of the base?
Each database has a selection of 100 random domains/sites (from the current database), which you can see for free and evaluate the quality of the database itself before buying.
And also on the site there are complete lists of domain zones (with the number of domains in the database for each domain zone) for each of the main databases, for example:

WordPress
100 random sites from the current database – https://world-bases.com/api/example.php?cms=wordpress
Information on domain zones – https://world-bases.com/api/info.php?cms=wordpress

Joomla
100 random sites from the current database – https://world-bases.com/api/example.php?cms=joomla
Information on domain zones – https://world-bases.com/api/info.php?cms=joomla

Magento
100 random sites from the current database – https://world-bases.com/api/example.php?cms=magento
Information on domain zones – https://world-bases.com/api/info.php?cms=magento

Drupal
100 random sites from the current database – https://world-bases.com/api/example.php?cms=drupal
Information on domain zones – https://world-bases.com/api/info.php?cms=drupal


All databases can be bought online on the out website: https://world-bases.com/en/

Contacts:
Telegram: https://t.me/wbits
Jabber: wb@creep.im

.(tagsToTranslate)domains(t)sites(t)bases