Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addresses in CartAddressResource uses non-existing address field as address line #383

Open
zaka-komma opened this issue Oct 8, 2024 · 0 comments

Comments

@zaka-komma
Copy link

zaka-komma commented Oct 8, 2024

File: Webkul\RestApi\Http\Resources\V1\Shop\Checkout\CartAddressResource
Line: 23

Current:
'address1' => explode(PHP_EOL, $this->address1),
Change request:
'address' => explode(PHP_EOL, $this->address),

We are trying to use the checkout save address functionality to set both shipping and billing addresses of the cart, but the response of the cart returns addresses with empty address1

An alternative way to solve this whole file is extending CartAddressResource from Webkul\Shop\Http\Resources\AddressResource

and then something like

    public function toArray($request)
    {
        Arr::only(parent::toArray($request), [
            'id',
            'first_name',
            'last_name',
            'name',
            'email',
            'address1',
            'country',
            'country_name',
            'state',
            'city',
            'postcode',
            'phone',
        ]) + [
            'country_name' => core()->country_name($this->country),
            'created_at'   => $this->created_at,
            'updated_at'   => $this->updated_at,
        ];
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant