addtocart – Add to cart functionality is not working for any product

my add to cart not working, its showing nothing in cart for 2 stores and for 1 store adding a default product everytime, doesn’t matter which product we added,
its showing this exception….

We can’t add above item to cart.Please contact administratorThe product wasn’t found. Verify the product and try again.

i have checked my code is fine, its working on local setup and dev server, just issue is on production,

i have tried with cookie lifetime increase and permission settings on directories but none worked..
do it need some more cookie or session changes which can be done ?

can any body share any idea or solution with some details ??

magento2.3 – Zero cart price Issue in ADD TO CART rest API

We have been using below REST URL to get the cart data-
rest/V1/carts/mine/items (passing customer token in each call )
Whenever first item is added to the cart, we always get product price – 0, as soon another item is added to the cart, price for first item started coming properly using the same API –
rest/V1/carts/mine/items

magento 1.7 – Setting shipping programmatically when product is added to cart?

Magento 1.7

This is the code which gets called via the checkout_cart_product_add_after event when I add a product to the cart:

function addProductComplete(Varien_Event_Observer $observer) {

        $onepage = Mage::getSingleton('checkout/type_onepage');
        $onepage->saveShippingMethod("flatrate_flatrate");

        // Add address to cart
        $address = $onepage->getQuote()->getShippingAddress();

        if (null == $address->getCountryId())
        {
            $country = Mage::helper('core')->getDefaultCountry(); // use default country
            if ( '' == $country )
            {
                $country = 'DE';
            }
            $address->setCountryId($country);
        }

        if ( null == $address->getPostcode() )
        {
            $address->setPostcode('00000');
        }
        $address->setShippingMethod('flatrate_flatrate');
        $address->setCollectShippingrates(true);

        // save settings
        $onepage->getQuote()->collectTotals()->save();
        $onepage->getQuote()->save();

    }

When I add the first product, nothing happens, only after adding the second product, it works. I guess thats because the first time there is no quote object? How to solve that so it works with the first product as well?

magento 1.9 – how can i show the textbox value entered on product page to checkout and cart page

In Magento 1 On product page https://prnt.sc/smp14a when someone enters the description I wanted to show the same description on cart page https://prnt.sc/smp8l7 and checkout page how can I do that

Values getting in parms
https://prnt.sc/smpiyd
In post request on
/app/code/core/Mage/Checkout/controllers/CartController.php
In addAction I am getting the text box value and have passed to cart as parameters

$cart   = $this->_getCart();
        $params = $this->getRequest()->getParams();
        try {
            if (isset($params('qty'))) {
                $filter = new Zend_Filter_LocalizedToNormalized(
                    array('locale' => Mage::app()->getLocale()->getLocaleCode())
                );
                $params('qty') = $filter->filter($params('qty'));
            }

            $product = $this->_initProduct();
            $related = $this->getRequest()->getParam('related_product');

            /**
             * Check product availability
             */
            if (!$product) {
                $this->_goBack();
                return;
            }

            $cart->addProduct($product, $params);

How can I access the textbox value on the cart page
thanks in advance

views – Drupal7 Commerce – Multiple Custom Line Items with single add to cart button

I am working on a system that pulls in available dates and booking references from a third party API – we then need to add these pieces of extra information to a line_item that is added to cart.

I have the custom line item setup by way of

'hook_commerce_line_item_type_info()'

What I would really like to see now is several products (Adult, Child, Concession) – all being available within one form – and a single add to bag button. With the caveat of needing to submit the custom line_item attributes at the same time (these values will be copied over using Javascript after being selected in the UI).

I have made use of commerce_add_to_cart_extras – which provides a view of the products – with a single add to bag – but no notion of being able to add the line_item attributes to the form. Indeed – I’m not even sure that the form processing of this module caters for custom line_item – even if my form_alter code managed to get the syntax of the extra fields correct:

$form_state('rebuild') = TRUE;
        $form('line_item_fields')('#tree') = TRUE;
        //line_item_fields(field_resource_id)(0)
        //line_item_fields(field_resource_id)(und)(0)(value)
        foreach(element_children($form('add_to_cart_quantity')) as $key) {
            //hook_form_FORM_ID_alter
          //  echo ("here: ".print_r($form('add_to_cart_quantity')($key)));                                    
            $form('line_item_fields')($key)('field_resource_id')('und')('0')('value')=array(
                '#type'=>'textfield',                
                '#product_id' => $form('add_to_cart_quantity')($key)('#product_id'),
                '#title'=>t('ResourceID'), 
                '#tree' => TRUE
            );
        }

Has anybody got a solution to how this can be done? We only have one product type – and one custom line item type to consider – and they have a 1:1 mapping.

Hope someone can help here!

How to remove view cart in wordpress

I tried to code the
SEMrush

.car-link a(title=”Cart”) { display: none; }

in theme editor in WordPress. Because I couldn’t access the “customize” in wordpress, it says

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 27750400 bytes) in /raid/vhost/parts.com.ph/www/wp-includes/functions.php on line 4339.

So I used theme editor, i tried inspector and writing { display:none} but it wasn’t working.

Here is the website. http:// parts . com . ph

 

Add free product to cart on orders over 999 / – in magento 2

I want to add 1 free product on orders over 999 / – and 2 same product on orders above 1499 / – in Magento 2.
Please help.

ajax – Woocommerce Cart Category limit

I’m using the following code to limit products from one category in the cart.

add_filter( 'woocommerce_add_to_cart_validation', 'only_one_product_category_allowed', 20, 3 );
function only_one_product_category_allowed( $passed, $product_id, $quantity) {

    $term_slugs   = wp_get_post_terms( $product_id, 'product_cat', array('fields' => 'slugs') );

    foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item ){

        if( ! has_term( $term_slugs, 'product_cat', $cart_item('product_id') ) ){

            wc_add_notice( __('Only goods from ONE category allowed in cart'), 'error' );
            echo "<script type='text/javascript'>alert('Only goods from ONE category allowed in cart');</script>";

            return false;
        }
    }
    return $passed;
}

Could someone please let me know how I can change the number of categories allowed in the cart at once instead of just one? And I’d like to know how the error message can be shown using ajax. The current error message only shows when the page is refreshed.

Any help is appreciated!

Cheers

magento2 – css is not working in magento 2 cart page

I have issue in cart page of my website . Currently home page and product pages are loading correctly but the cart page have issue Css and js fies in the cart page is not working

enter image description here

Please help to solve this . I have seen this question Magento 2 StyleSheet not loading

But I am not sure i can apply that solution . Please check .

I have tried sudo php bin/magento setup:static-content:deploy ,but still the cart page is same