0

I'm trying to configure the visibility of some products for a specific date, but I can't find what configuration I should select for this action to take place.

1
  • Magento desn't provide facility for enable/disable product at specific date. You can change desing and layout for specific date range.
    – S.P
    Commented Mar 15, 2023 at 6:27

3 Answers 3

0

Could you please do these below steps, hope that will help

  1. Login to the Magento 2 admin panel.
  2. Navigate to the "Products" menu and select "Catalog."
  3. Find the product that you want to configure and click on it.
  4. In the "Product Details" page, go to the "Schedule Design Update" section.
  5. In the "From" field, select the start date from which you want the product to be visible.
  6. In the "To" field, select the end date till which you want the product to be visible.
  7. In the "Display Settings" section, select the visibility options that you want for the product during the specified date range.
  8. Click on the "Save" button to save the changes.
1
  • Thank you very much, I will try this method Commented Mar 15, 2023 at 21:10
0

I think you have to make a new extension.

0

Magento Doesn't provide this type of facility, You can update design and layout from adminpanel for particular date range.

I think you need to create two product attribute. Visible_from_date and Visible_To_date.

And need to update product collection.

$productColl->addFieldToFilter('Visible_from_date', ['lteq' => $now->format('Y-m-d H:i:s')])
        ->addFieldToFilter('Visible_To_date', ['gteq' => $now->format('Y-m-d H:i:s')]);

You can take help from below exetension. https://github.com/php-cuong/magento2-restrict-products

There you need to update collection in plugin file Plugin/CatalogSearch/Search/IndexBuilder.php

 $productIds = $this->productCollectionFactory->create()
            ->addAttributeToSelect('*')
    ->addFieldToFilter('Visible_from_date', ['lteq' => $now->format('Y-m-d H:i:s')])
            ->addFieldToFilter('Visible_To_date', ['gteq' => $now->format('Y-m-d H:i:s')])
        
        ->getAllIds();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.